Compare commits
37 Commits
v1.5.0-rc3
...
v1.5-branc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77908ed995 | ||
|
|
1d6259edc9 | ||
|
|
12784125b9 | ||
|
|
bc038e5e78 | ||
|
|
68cf168798 | ||
|
|
69bddff823 | ||
|
|
5ca45ba3f2 | ||
|
|
93d47e6925 | ||
|
|
0e6c11ac5d | ||
|
|
4a8f65cccf | ||
|
|
26f37bab4c | ||
|
|
9cfed4940c | ||
|
|
6f36d7d9bc | ||
|
|
5bd398d3e3 | ||
|
|
2bf22ae0e8 | ||
|
|
78ce02f86d | ||
|
|
47edaa343b | ||
|
|
e288040b7b | ||
|
|
8c55291e83 | ||
|
|
24dfee30c3 | ||
|
|
0a2d7953e2 | ||
|
|
2599c6075e | ||
|
|
c18ec01fdc | ||
|
|
a713d4be6f | ||
|
|
b3d65931a5 | ||
|
|
03c40a2685 | ||
|
|
83298d8020 | ||
|
|
4bcefbba73 | ||
|
|
7bc48f69c2 | ||
|
|
ebf02d4b7d | ||
|
|
b8a27f30fe | ||
|
|
7f09bef9da | ||
|
|
bc94f7c723 | ||
|
|
701f0598a8 | ||
|
|
8e4275298c | ||
|
|
db493450ac | ||
|
|
09cf85a94b |
4
Kbuild
4
Kbuild
@@ -50,7 +50,9 @@ misc/generated/sysgen/prj.mdef: $(MDEF_FILE_PATH) \
|
||||
misc/generated/sysgen/kernel_main.c: misc/generated/sysgen/prj.mdef \
|
||||
kernel/microkernel/include/micro_private_types.h \
|
||||
kernel/microkernel/include/kernel_main.h
|
||||
$(Q)$(srctree)/scripts/sysgen $(CURDIR)/misc/generated/sysgen/prj.mdef $(CURDIR)/misc/generated/sysgen/
|
||||
$(Q)$(PYTHON) $(srctree)/scripts/sysgen \
|
||||
$(CURDIR)/misc/generated/sysgen/prj.mdef \
|
||||
$(CURDIR)/misc/generated/sysgen/
|
||||
|
||||
define filechk_configs.c
|
||||
(echo "/* file is auto-generated, do not modify ! */"; \
|
||||
|
||||
26
Makefile
26
Makefile
@@ -1,5 +1,5 @@
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 4
|
||||
VERSION_MINOR = 5
|
||||
PATCHLEVEL = 0
|
||||
VERSION_RESERVED = 0
|
||||
EXTRAVERSION =
|
||||
@@ -739,14 +739,13 @@ export KBUILD_IMAGE ?= zephyr
|
||||
|
||||
zephyr-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(drivers-y) \
|
||||
$(libs-y)))
|
||||
zephyr-app-dir-root := $(abspath $(patsubst %, %/.., $(SOURCE_DIR)))
|
||||
|
||||
zephyr-app-dirs := $(SOURCE_DIR)
|
||||
|
||||
zephyr-alldirs := $(sort $(zephyr-dirs) $(zephyr-app-dirs) $(patsubst %/,%,$(filter %/, \
|
||||
zephyr-alldirs := $(sort $(zephyr-dirs) $(SOURCE_DIR) $(patsubst %/,%,$(filter %/, \
|
||||
$(core-) $(drivers-) $(libs-) $(app-))))
|
||||
|
||||
core-y := $(patsubst %/, %/built-in.o, $(core-y))
|
||||
app-y := $(patsubst %, %/built-in.o, $(notdir $(zephyr-app-dirs)))
|
||||
app-y := $(patsubst %, %/built-in.o, $(notdir $(SOURCE_DIR)))
|
||||
drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
|
||||
libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
|
||||
libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
|
||||
@@ -883,7 +882,7 @@ zephyr: $(zephyr-deps) $(KERNEL_BIN_NAME)
|
||||
|
||||
# The actual objects are generated when descending,
|
||||
# make sure no implicit rule kicks in
|
||||
$(sort $(zephyr-deps)): $(zephyr-dirs) $(zephyr-app-dirs) ;
|
||||
$(sort $(zephyr-deps)): $(zephyr-dirs) zephyr-app-dir ;
|
||||
|
||||
# Handle descending into subdirectories listed in $(zephyr-dirs)
|
||||
# Preset locale variables to speed up the build process. Limit locale
|
||||
@@ -895,10 +894,9 @@ PHONY += $(zephyr-dirs)
|
||||
$(zephyr-dirs): prepare scripts
|
||||
$(Q)$(MAKE) $(build)=$@
|
||||
|
||||
PHONY += $(zephyr-app-dirs)
|
||||
$(zephyr-app-dirs): zephyr-app-dir-root = $(abspath $(patsubst %, %/.., $@))
|
||||
$(zephyr-app-dirs): prepare scripts
|
||||
$(Q)$(MAKE) $(build)=$(@F) srctree=$(zephyr-app-dir-root)
|
||||
PHONY += zephyr-app-dir
|
||||
zephyr-app-dir: prepare scripts
|
||||
$(Q)$(MAKE) $(build)=$(notdir $(SOURCE_DIR)) srctree=$(zephyr-app-dir-root)
|
||||
|
||||
# Things we need to do before we recursively start building the kernel
|
||||
# or the modules are listed in "prepare".
|
||||
@@ -1019,9 +1017,9 @@ clean: rm-dirs := $(CLEAN_DIRS)
|
||||
clean: rm-files := $(CLEAN_FILES)
|
||||
clean-dirs := $(addprefix _clean_, . $(zephyr-alldirs) )
|
||||
|
||||
PHONY += $(clean-dirs) clean archclean zephyrclean
|
||||
$(clean-dirs):
|
||||
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
||||
PHONY += clean-dirs-target clean archclean zephyrclean
|
||||
clean-dirs-target:
|
||||
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$(clean-dirs))
|
||||
|
||||
clean: archclean
|
||||
|
||||
@@ -1134,7 +1132,7 @@ $(help-board-dirs): help-%:
|
||||
%docs: FORCE
|
||||
$(Q)$(MAKE) -C doc htmldocs
|
||||
|
||||
clean: $(clean-dirs)
|
||||
clean: clean-dirs-target
|
||||
$(call cmd,rmdirs)
|
||||
$(call cmd,rmfiles)
|
||||
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
# vim: filetype=make
|
||||
#
|
||||
|
||||
DQUOTE = "
|
||||
# "
|
||||
|
||||
ARCH ?= x86
|
||||
|
||||
UNAME := $(shell uname)
|
||||
ifeq (MINGW, $(findstring MINGW, $(UNAME)))
|
||||
DQUOTE = '
|
||||
# '
|
||||
PROJECT_BASE ?= $(shell sh -c "pwd -W")
|
||||
else
|
||||
DQUOTE = "
|
||||
# "
|
||||
PROJECT_BASE ?= $(CURDIR)
|
||||
endif
|
||||
|
||||
@@ -64,7 +65,7 @@ endif
|
||||
export CFLAGS
|
||||
|
||||
zephyrmake = +$(MAKE) -C $(ZEPHYR_BASE) O=$(1) \
|
||||
PROJECT=$(PROJECT_BASE) SOURCE_DIR="$(SOURCE_DIR)" $(2)
|
||||
PROJECT=$(PROJECT_BASE) SOURCE_DIR=$(DQUOTE)$(SOURCE_DIR)$(DQUOTE) $(2)
|
||||
|
||||
BOARDCONFIG = $(O)/.board_$(BOARD)
|
||||
|
||||
|
||||
66
doc/conf.py
66
doc/conf.py
@@ -52,14 +52,32 @@ project = u'Zephyr Project'
|
||||
copyright = u'2015, Intel Corporation, Wind River Systems, Inc'
|
||||
author = u'many'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = os.getenv('KERNELVERSION','0.1.0')
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = os.getenv('KERNELVERSION','0.1.0')
|
||||
|
||||
# The following code tries to extract the information by reading the Makefile,
|
||||
# when Sphinx is run directly (e.g. by Read the Docs).
|
||||
try:
|
||||
makefile_version_major = None
|
||||
makefile_version_minor = None
|
||||
makefile_patchlevel = None
|
||||
for line in open('../Makefile'):
|
||||
key, val = [x.strip() for x in line.split('=', 2)]
|
||||
if key == 'VERSION_MAJOR':
|
||||
makefile_version_major = val
|
||||
if key == 'VERSION_MINOR':
|
||||
makefile_version_minor = val
|
||||
elif key == 'PATCHLEVEL':
|
||||
makefile_patchlevel = val
|
||||
if makefile_version_major and makefile_version_minor and makefile_patchlevel:
|
||||
break
|
||||
except:
|
||||
pass
|
||||
finally:
|
||||
if makefile_version_major and makefile_version_minor and makefile_patchlevel:
|
||||
version = release = makefile_version_major + '.' + makefile_version_minor + '.' + makefile_patchlevel
|
||||
else:
|
||||
sys.stderr.write('Warning: Could not extract kernel version\n')
|
||||
version = release = "unknown version"
|
||||
version = release = os.getenv('KERNELVERSION','0.1.0')
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -112,18 +130,25 @@ rst_epilog = """
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#html_theme = 'alabaster'
|
||||
html_theme = 'zephyr'
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
except ImportError:
|
||||
html_theme = 'zephyr'
|
||||
html_theme_path = ['./themes']
|
||||
else:
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
if tags.has('daily') or tags.has('release'):
|
||||
html_theme = 'zephyr-docs-theme'
|
||||
html_theme_path = ['./themes']
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
html_theme_path = ['./themes']
|
||||
if tags.has('release'):
|
||||
is_release = True
|
||||
docs_title = 'Docs / %s' %(version)
|
||||
else:
|
||||
is_release = False
|
||||
docs_title = 'Docs'
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
@@ -186,7 +211,7 @@ html_split_index = True
|
||||
html_show_sphinx = False
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
html_show_copyright = True
|
||||
html_show_copyright = tags.has('development')
|
||||
|
||||
# If true, license is shown in the HTML footer. Default is True.
|
||||
html_show_license = True
|
||||
@@ -303,6 +328,9 @@ breathe_projects = {
|
||||
}
|
||||
breathe_default_project = "Zephyr"
|
||||
|
||||
# docs_title is used in the breadcrumb title in the zephyr docs theme
|
||||
html_context = {
|
||||
'show_license': html_show_license,
|
||||
'docs_title': docs_title,
|
||||
'is_release': is_release,
|
||||
}
|
||||
|
||||
@@ -11,16 +11,16 @@ Zephyr Project Documentation
|
||||
Documentation for the development branch of Zephyr can be found at
|
||||
https://www.zephyrproject.org/doc/
|
||||
|
||||
.. only:: development
|
||||
.. only:: (development or daily)
|
||||
|
||||
Welcome to the Zephyr Project's documentation. This is the documentation of the
|
||||
master tree under development.
|
||||
master tree under development (version |version|).
|
||||
|
||||
Documentation for released versions of Zephyr can be found at
|
||||
``https://www.zephyrproject.org/doc/<version>``. The following documentation
|
||||
versions are available:
|
||||
|
||||
`Zephyr 1.1.0`_ | `Zephyr 1.2.0`_ | `Zephyr 1.3.0`_ | `Zephyr 1.4.0`_ | `Zephyr 1.5.0`_
|
||||
`Zephyr 1.1.0`_ | `Zephyr 1.2.0`_ | `Zephyr 1.3.0`_ | `Zephyr 1.4.0`_
|
||||
|
||||
Sections
|
||||
********
|
||||
|
||||
@@ -7,6 +7,59 @@ The networking section contains information regarding the network stack
|
||||
of the Zephyr kernel. Use the information to understand the
|
||||
principles behind the operation of the stacks and how they were implemented.
|
||||
|
||||
The networking stack supports the following features:
|
||||
|
||||
* IPv6
|
||||
|
||||
* IPv6 header compresson, which is part of the 6LoWPAN support
|
||||
|
||||
* UDP
|
||||
* IPv4
|
||||
|
||||
* In this version of the IP stack, IPv6 and IPv4 cannot be utilized at the
|
||||
same time.
|
||||
* DHCP client support for IPv4
|
||||
|
||||
* TCP
|
||||
|
||||
* Both client and server roles are supported
|
||||
|
||||
* RPL (Ripple) IPv6 mesh routing
|
||||
* CoAP
|
||||
* MQTT
|
||||
* Highly configurable
|
||||
|
||||
* Features, buffer sizes/counts, stack sizes, etc.
|
||||
|
||||
Additionally these network technologies are supported:
|
||||
|
||||
* IEEE 802.15.4
|
||||
* Bluetooth
|
||||
* Ethernet
|
||||
* SLIP (for testing with Qemu)
|
||||
|
||||
Source tree layout
|
||||
==================
|
||||
|
||||
The IP stack source code tree is organized as follows:
|
||||
|
||||
``net/ip/``
|
||||
The core stack itself. This is where the Contiki uIP stack code
|
||||
is located.
|
||||
|
||||
``include/net/``
|
||||
Public API header files. These are the header files applications need
|
||||
to include to use IP networking functionality.
|
||||
|
||||
``samples/net/``
|
||||
Sample networking code. This is a good reference to get started with
|
||||
network application development.
|
||||
|
||||
``tests/net/``
|
||||
Test applications. These applications are used to verify the
|
||||
functionality of the IP stack, but are not the best
|
||||
source for sample code (see ``samples/net`` instead).
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
|
||||
@@ -769,56 +769,6 @@ static int cc2520_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc2520_set_txpower(struct device *dev, short dbm)
|
||||
{
|
||||
struct cc2520_context *cc2520 = dev->driver_data;
|
||||
uint8_t pwr;
|
||||
|
||||
SYS_LOG_DBG("%s: %d\n", dbm);
|
||||
|
||||
/* See chapter 19 part 8 */
|
||||
switch (dbm) {
|
||||
case 5:
|
||||
pwr = 0xF7;
|
||||
break;
|
||||
case 3:
|
||||
pwr = 0xF2;
|
||||
break;
|
||||
case 2:
|
||||
pwr = 0xAB;
|
||||
break;
|
||||
case 1:
|
||||
pwr = 0x13;
|
||||
break;
|
||||
case 0:
|
||||
pwr = 0x32;
|
||||
break;
|
||||
case -2:
|
||||
pwr = 0x81;
|
||||
break;
|
||||
case -4:
|
||||
pwr = 0x88;
|
||||
break;
|
||||
case -7:
|
||||
pwr = 0x2C;
|
||||
break;
|
||||
case -18:
|
||||
pwr = 0x03;
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!write_reg_txpower(&cc2520->spi, pwr)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
error:
|
||||
SYS_LOG_ERR("%s: FAILED\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int cc2520_tx(struct device *dev, struct net_buf *buf)
|
||||
{
|
||||
struct cc2520_context *cc2520 = dev->driver_data;
|
||||
|
||||
@@ -158,32 +158,35 @@ pwm_set_port_return:
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the duration for on/off timer of PWM.
|
||||
* Set the time to assert and de-assert the PWM pin.
|
||||
*
|
||||
* This sets the duration for the pin to low or high.
|
||||
* This sets the duration for the pin to stay low or high.
|
||||
*
|
||||
* Assumes a nominal system clock of 32MHz, each count of on/off represents
|
||||
* 31.25ns (e.g. on == 2 means the pin stays high for 62.5ns).
|
||||
* The duration of 1 count depends on system clock. Refer to the hardware
|
||||
* manual for more information.
|
||||
* For example, with a nominal system clock of 32MHz, each count of on/off
|
||||
* represents 31.25ns (e.g. off == 2 means the pin is to be de-asserted at
|
||||
* 62.5ns from the beginning of a PWM cycle). The duration of 1 count depends
|
||||
* on system clock. Refer to the hardware manual for more information.
|
||||
*
|
||||
* Parameters
|
||||
* dev: Device struct
|
||||
* dev: Pointer to PWM device structure
|
||||
* access_op: whether to set one pin or all
|
||||
* pwm: Which PWM port to set
|
||||
* on: Duration for pin to stay high (must be >= 2)
|
||||
* off: Duration for pin to stay low (must be >= 2)
|
||||
* pwm: PWM port number to set
|
||||
* on: How far (in timer count) from the beginning of a PWM cycle the PWM
|
||||
* pin should be asserted. Must be zero, since PWM from Quark MCU always
|
||||
* starts from high.
|
||||
* off: How far (in timer count) from the beginning of a PWM cycle the PWM
|
||||
* pin should be de-asserted.
|
||||
*
|
||||
* return 0, -ENOTSUP
|
||||
* return 0, or negative errno code
|
||||
*/
|
||||
static int pwm_qmsi_set_values(struct device *dev, int access_op,
|
||||
uint32_t pwm, uint32_t on, uint32_t off)
|
||||
uint32_t pwm, uint32_t on, uint32_t off)
|
||||
{
|
||||
int i;
|
||||
uint32_t *channel_period = dev->config->config_info;
|
||||
int i, high, low;
|
||||
|
||||
if (off == 0) {
|
||||
on--;
|
||||
off = 1;
|
||||
if (on) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (access_op) {
|
||||
@@ -192,13 +195,40 @@ static int pwm_qmsi_set_values(struct device *dev, int access_op,
|
||||
if (pwm >= CONFIG_PWM_QMSI_NUM_PORTS) {
|
||||
return -EIO;
|
||||
}
|
||||
return __set_one_port(dev, QM_PWM_0, pwm, on, off);
|
||||
|
||||
high = off;
|
||||
low = channel_period[pwm] - off;
|
||||
|
||||
if (off >= channel_period[pwm]) {
|
||||
high = channel_period[pwm] - 1;
|
||||
low = 1;
|
||||
}
|
||||
|
||||
if (off == 0) {
|
||||
high = 1;
|
||||
low = channel_period[pwm] - 1;
|
||||
}
|
||||
|
||||
return __set_one_port(dev, QM_PWM_0, pwm, high, low);
|
||||
|
||||
case PWM_ACCESS_ALL:
|
||||
for (i = 0; i < CONFIG_PWM_QMSI_NUM_PORTS; i++) {
|
||||
__set_one_port(dev, QM_PWM_0, i, on, off);
|
||||
high = off;
|
||||
low = channel_period[i] - off;
|
||||
|
||||
if (off >= channel_period[i]) {
|
||||
high = channel_period[i] - 1;
|
||||
low = 1;
|
||||
}
|
||||
|
||||
if (off == 0) {
|
||||
high = 1;
|
||||
low = channel_period[i] - 1;
|
||||
}
|
||||
|
||||
return __set_one_port(dev, QM_PWM_0, i, high, low);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
@@ -208,7 +238,7 @@ static int pwm_qmsi_set_values(struct device *dev, int access_op,
|
||||
}
|
||||
|
||||
static int pwm_qmsi_set_period(struct device *dev, int access_op,
|
||||
uint32_t pwm, uint32_t period)
|
||||
uint32_t pwm, uint32_t period)
|
||||
{
|
||||
uint32_t *channel_period = dev->config->config_info;
|
||||
int ret_val = 0;
|
||||
@@ -295,12 +325,23 @@ static int pwm_qmsi_set_duty_cycle(struct device *dev, int access_op,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pwm_qmsi_set_phase(struct device *dev, int access_op,
|
||||
uint32_t pwm, uint8_t phase)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
ARG_UNUSED(access_op);
|
||||
ARG_UNUSED(pwm);
|
||||
ARG_UNUSED(phase);
|
||||
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static struct pwm_driver_api pwm_qmsi_drv_api_funcs = {
|
||||
.config = pwm_qmsi_configure,
|
||||
.set_values = pwm_qmsi_set_values,
|
||||
.set_period = pwm_qmsi_set_period,
|
||||
.set_duty_cycle = pwm_qmsi_set_duty_cycle,
|
||||
.set_phase = pwm_qmsi_set_phase
|
||||
};
|
||||
|
||||
static int pwm_qmsi_init(struct device *dev)
|
||||
|
||||
@@ -114,8 +114,10 @@ static inline int pwm_pin_configure(struct device *dev, uint8_t pwm,
|
||||
*
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
* @param pwm PWM output.
|
||||
* @param on ON value set to the PWM.
|
||||
* @param off OFF value set to the PWM.
|
||||
* @param on ON value (number of timer count) set to the PWM. HW specific.
|
||||
* How far from the beginning of a PWM cycle the PWM pulse starts.
|
||||
* @param off OFF value (number of timer count) set to the PWM. HW specific.
|
||||
* How far from the beginning of a PWM cycle the PWM pulse stops.
|
||||
*
|
||||
* @retval 0 If successful.
|
||||
* @retval Negative errno code if failure.
|
||||
@@ -220,8 +222,10 @@ static inline int pwm_all_configure(struct device *dev, int flags)
|
||||
* @brief Set the ON/OFF values for all PWM outputs.
|
||||
*
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
* @param on ON value set to the PWM.
|
||||
* @param off OFF value set to the PWM.
|
||||
* @param on ON value (number of timer count) set to the PWM. HW specific.
|
||||
* How far from the beginning of a PWM cycle the PWM pulse starts.
|
||||
* @param off OFF value (number of timer count) set to the PWM. HW specific.
|
||||
* How far from the beginning of a PWM cycle the PWM pulse stops.
|
||||
*
|
||||
* @retval 0 If successful.
|
||||
* @retval Negative errno code if failure.
|
||||
|
||||
@@ -411,6 +411,7 @@ default n
|
||||
help
|
||||
The 802.15.4 layer can either support loopback within
|
||||
or loopback with uart but not both at the same time.
|
||||
|
||||
config NETWORKING_WITH_15_4_TI_CC2520
|
||||
bool
|
||||
prompt "TI CC2520"
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
CONFIG_COMPILER_OPT="-O0"
|
||||
CONFIG_CPLUSPLUS=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -18,8 +18,13 @@
|
||||
* @file C++ Synchronization demo. Uses basic C++ functionality.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @class semaphore the basic pure virtual semaphore class
|
||||
@@ -70,7 +75,7 @@ public:
|
||||
*/
|
||||
task_semaphore::task_semaphore(): _sema_internal(__K_SEMAPHORE_DEFAULT)
|
||||
{
|
||||
SYS_LOG_INF("Create semaphore %p", this);
|
||||
PRINT("Create semaphore %p\n", this);
|
||||
sema = (ksem_t)&_sema_internal;
|
||||
}
|
||||
|
||||
@@ -130,7 +135,7 @@ void hello_loop(const char *taskname,
|
||||
my_sem.wait();
|
||||
|
||||
/* say "hello" */
|
||||
SYS_LOG_INF("%s: Hello World!", taskname);
|
||||
PRINT("%s: Hello World!\n", taskname);
|
||||
|
||||
/* wait a while, then let other task have a turn */
|
||||
task_sleep(SLEEPTICKS);
|
||||
@@ -195,7 +200,7 @@ public:
|
||||
*/
|
||||
nano_semaphore::nano_semaphore()
|
||||
{
|
||||
SYS_LOG_INF("Create semaphore %p", this);
|
||||
PRINT("Create semaphore %p\n", this);
|
||||
nano_sem_init(&_sema_internal);
|
||||
}
|
||||
|
||||
@@ -258,7 +263,7 @@ void fiber_entry(void)
|
||||
nano_sem_fiber.wait();
|
||||
|
||||
/* say "hello" */
|
||||
SYS_LOG_INF("Hello World!");
|
||||
PRINT("%s: Hello World!\n", __FUNCTION__);
|
||||
|
||||
/* wait a while, then let task have a turn */
|
||||
nano_fiber_timer_start(&timer, SLEEPTICKS);
|
||||
@@ -279,7 +284,7 @@ void main(void)
|
||||
|
||||
while (1) {
|
||||
/* say "hello" */
|
||||
SYS_LOG_INF("Hello World!");
|
||||
PRINT("%s: Hello World!\n", __FUNCTION__);
|
||||
|
||||
/* wait a while, then let fiber have a turn */
|
||||
nano_task_timer_start(&timer, SLEEPTICKS);
|
||||
|
||||
@@ -20,10 +20,16 @@
|
||||
|
||||
#include <device.h>
|
||||
#include <misc/byteorder.h>
|
||||
#define SYS_LOG_NO_NEWLINE
|
||||
#include <misc/sys_log.h>
|
||||
#include <adc.h>
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define DBG printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define DBG printk
|
||||
#endif
|
||||
|
||||
#define SLEEPTIME 2
|
||||
#define SLEEPTICKS (SLEEPTIME * sys_clock_ticks_per_sec)
|
||||
|
||||
@@ -57,11 +63,11 @@ static struct adc_seq_table table = {
|
||||
|
||||
static void _print_sample_in_hex(uint8_t *buf, uint32_t length)
|
||||
{
|
||||
SYS_LOG_DBG("Buffer content:\n");
|
||||
DBG("Buffer content:\n");
|
||||
for (; length > 0; length -= 4, buf += 4) {
|
||||
SYS_LOG_DBG("0x%x ", *((uint32_t *)buf));
|
||||
DBG("0x%x ", *((uint32_t *)buf));
|
||||
}
|
||||
SYS_LOG_DBG("\n");
|
||||
DBG("\n");
|
||||
}
|
||||
|
||||
void main(void)
|
||||
@@ -70,11 +76,11 @@ void main(void)
|
||||
struct nano_timer timer;
|
||||
uint32_t data[2] = {0, 0};
|
||||
|
||||
SYS_LOG_DBG("ADC sample started on %s\n", ADC_DEVICE_NAME);
|
||||
DBG("ADC sample started on %s\n", ADC_DEVICE_NAME);
|
||||
|
||||
adc = device_get_binding(ADC_DEVICE_NAME);
|
||||
if (!adc) {
|
||||
SYS_LOG_DBG("Cannot get adc controller\n");
|
||||
DBG("Cannot get adc controller\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,9 +88,9 @@ void main(void)
|
||||
adc_enable(adc);
|
||||
while (1) {
|
||||
if (adc_read(adc, &table) != 0) {
|
||||
SYS_LOG_DBG("Sampling could not proceed, an error occurred\n");
|
||||
DBG("Sampling could not proceed, an error occurred\n");
|
||||
} else {
|
||||
SYS_LOG_DBG("Sampling is done\n");
|
||||
DBG("Sampling is done\n");
|
||||
_print_sample_in_hex(seq_buffer, BUFFER_SIZE);
|
||||
}
|
||||
nano_timer_start(&timer, SLEEPTICKS);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_PRINTK=y
|
||||
CONFIG_AIO_COMPARATOR=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -34,8 +34,13 @@
|
||||
* The line "*** A0, AIN[10] triggered falling." should appear.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <stdint.h>
|
||||
@@ -66,8 +71,9 @@ void cb(void *param)
|
||||
|
||||
aio_cmp_dev = device_get_binding("AIO_CMP_0");
|
||||
|
||||
SYS_LOG_INF("*** %s triggered %s.", &p->name,
|
||||
(p->pol == AIO_CMP_POL_RISE) ? "rising" : "falling");
|
||||
PRINT("*** %s triggered %s.\n", &p->name,
|
||||
(p->pol == AIO_CMP_POL_RISE) ? "rising" : "falling"
|
||||
);
|
||||
|
||||
if (p->pol == AIO_CMP_POL_RISE)
|
||||
p->pol = AIO_CMP_POL_FALL;
|
||||
@@ -89,7 +95,7 @@ void main(void)
|
||||
|
||||
aio_cmp_dev = device_get_binding("AIO_CMP_0");
|
||||
|
||||
SYS_LOG_INF("===== app started ========");
|
||||
PRINT("===== app started ========\n");
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
/* REF_A is to use AREF for reference */
|
||||
@@ -97,12 +103,12 @@ void main(void)
|
||||
cb_data.pol, cb_data.ref,
|
||||
cb, &cb_data);
|
||||
if (ret)
|
||||
SYS_LOG_ERR("ERROR registering callback for %s (%d)",
|
||||
PRINT("ERROR registering callback for %s (%d)\n",
|
||||
&cb_data.name, ret);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
SYS_LOG_INF("... waiting for event! (%d)", ++cnt);
|
||||
PRINT("... waiting for event! (%d)\n", ++cnt);
|
||||
|
||||
/* wait a while */
|
||||
nano_task_timer_start(&timer, SLEEPTIME);
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -19,8 +19,13 @@
|
||||
#include <gpio.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
/* change this to use another GPIO port */
|
||||
#define PORT "GPIOC"
|
||||
@@ -35,7 +40,7 @@
|
||||
void button_pressed(struct device *gpiob,
|
||||
struct gpio_callback *cb, uint32_t pins)
|
||||
{
|
||||
SYS_LOG_INF("Button pressed at %d", sys_tick_get_32());
|
||||
PRINT("Button pressed at %d\n", sys_tick_get_32());
|
||||
}
|
||||
|
||||
static struct gpio_callback gpio_cb;
|
||||
@@ -60,7 +65,7 @@ void main(void)
|
||||
int val = 0;
|
||||
|
||||
gpio_pin_read(gpiob, PIN, &val);
|
||||
SYS_LOG_INF("GPIO val: %d", val);
|
||||
PRINT("GPIO val: %d\n", val);
|
||||
task_sleep(MSEC(500));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
CONFIG_DMA=y
|
||||
CONFIG_DMA_QMSI=y
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_SYS_LOG_DMA_LEVEL=4
|
||||
@@ -21,8 +21,13 @@
|
||||
#include <device.h>
|
||||
#include <dma.h>
|
||||
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_DMA_LEVEL
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define DBG printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define DBG printk
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -61,7 +66,7 @@ static void test_transfer(struct device *dev, void *data)
|
||||
|
||||
static void test_error(struct device *dev, void *data)
|
||||
{
|
||||
SYS_LOG_ERR("DMA could not proceed, an error occurred");
|
||||
DBG("DMA could not proceed, an error occurred\n");
|
||||
}
|
||||
|
||||
void main(void)
|
||||
@@ -73,13 +78,12 @@ void main(void)
|
||||
struct dma_channel_config dma_chan_cfg = {0};
|
||||
struct dma_transfer_config dma_trans = {0};
|
||||
|
||||
SYS_LOG_DBG("DMA memory to memory transfer started on %s",
|
||||
DMA_DEVICE_NAME);
|
||||
SYS_LOG_DBG("Preparing DMA Controller");
|
||||
DBG("DMA memory to memory transfer started on %s\n", DMA_DEVICE_NAME);
|
||||
DBG("Preparing DMA Controller\n");
|
||||
|
||||
dma = device_get_binding(DMA_DEVICE_NAME);
|
||||
if (!dma) {
|
||||
SYS_LOG_ERR("Cannot get dma controller");
|
||||
DBG("Cannot get dma controller\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,22 +99,22 @@ void main(void)
|
||||
dma_chan_cfg.callback_data = (void *)&chan_id;
|
||||
|
||||
if (dma_channel_config(dma, chan_id, &dma_chan_cfg)) {
|
||||
SYS_LOG_ERR("configuration");
|
||||
DBG("Error: configuration\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SYS_LOG_DBG("Starting the transfer and waiting for 1 second");
|
||||
DBG("Starting the transfer and waiting for 1 second\n");
|
||||
dma_trans.block_size = strlen(tx_data);
|
||||
dma_trans.source_address = (uint32_t *)tx_data;
|
||||
dma_trans.destination_address = (uint32_t *)rx_data[transfer_count];
|
||||
|
||||
if (dma_transfer_config(dma, chan_id, &dma_trans)) {
|
||||
SYS_LOG_ERR("transfer");
|
||||
DBG("ERROR: transfer\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dma_transfer_start(dma, chan_id)) {
|
||||
SYS_LOG_ERR("transfer");
|
||||
DBG("ERROR: transfer\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -120,18 +124,18 @@ void main(void)
|
||||
|
||||
if (transfer_count < TRANSFER_LOOPS) {
|
||||
transfer_count = TRANSFER_LOOPS;
|
||||
SYS_LOG_ERR("unfinished transfer");
|
||||
DBG("ERROR: unfinished transfer\n");
|
||||
if (dma_transfer_stop(dma, chan_id)) {
|
||||
SYS_LOG_ERR("transfer stop");
|
||||
DBG("ERROR: transfer stop\n");
|
||||
}
|
||||
}
|
||||
|
||||
SYS_LOG_DBG("Each RX buffer should contain the full TX buffer string.");
|
||||
SYS_LOG_DBG("TX data: %s", tx_data);
|
||||
DBG("Each RX buffer should contain the full TX buffer string.\n");
|
||||
DBG("TX data: %s\n", tx_data);
|
||||
|
||||
for (int i = 0; i < TRANSFER_LOOPS; i++) {
|
||||
SYS_LOG_DBG("RX data Loop %d: %s", i, rx_data[i]);
|
||||
DBG("RX data Loop %d: %s\n", i, rx_data[i]);
|
||||
}
|
||||
|
||||
SYS_LOG_INF("Finished: DMA");
|
||||
DBG("Finished: DMA\n");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_PCI_ENUMERATION=y
|
||||
CONFIG_PCI_DEBUG=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -20,8 +20,13 @@
|
||||
#include <stdint.h>
|
||||
#include <pci/pci.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
void pci_enumerate(void)
|
||||
{
|
||||
@@ -54,7 +59,7 @@ void task_enum_pci(void)
|
||||
}
|
||||
|
||||
pci_enumerate();
|
||||
SYS_LOG_INF("Enumeration complete on %s", CONFIG_ARCH);
|
||||
PRINT("Enumeration complete on %s", CONFIG_ARCH);
|
||||
done = 1;
|
||||
}
|
||||
|
||||
@@ -63,7 +68,7 @@ void task_enum_pci(void)
|
||||
void main(void)
|
||||
{
|
||||
pci_enumerate();
|
||||
SYS_LOG_INF("Enumeration complete on %s", CONFIG_ARCH);
|
||||
PRINT("Enumeration complete on %s", CONFIG_ARCH);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MICROKERNEL */
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
* The sample runs like this on PWM[0] (IO3):
|
||||
* 1. At first, the period for the PWM is 1 second on, 1 second off.
|
||||
* 2. Every 4 seconds, the period is halved.
|
||||
* 3. After the period is faster than 10ms, period starts to double.
|
||||
* 3. After the period is faster than 1 ms on and 1 ms off, period
|
||||
* starts to double.
|
||||
* 4. Every 4 seconds, period is doubled.
|
||||
* 5. When period is longer than 1 seconds, repeat from 2.
|
||||
*
|
||||
@@ -44,11 +45,20 @@
|
||||
#include <pwm.h>
|
||||
#include <sys_clock.h>
|
||||
|
||||
/* about 1 ms */
|
||||
#define MIN_PERIOD 32000
|
||||
#define HW_CLOCK_CYCLES_PER_USEC (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / \
|
||||
USEC_PER_SEC)
|
||||
|
||||
/* about 1 second */
|
||||
#define MAX_PERIOD 32000000
|
||||
/**
|
||||
* unit: micro second.
|
||||
* 1 m sec for "on" or "off" time.
|
||||
*/
|
||||
#define MIN_PERIOD 1000
|
||||
|
||||
/**
|
||||
* unit: micro second.
|
||||
* 1 sec for "on" or "off" time
|
||||
*/
|
||||
#define MAX_PERIOD 1000000
|
||||
|
||||
#define SLEEPTICKS SECONDS(4)
|
||||
|
||||
@@ -69,25 +79,34 @@ void main(void)
|
||||
printk("Cannot find PWM_0!\n");
|
||||
}
|
||||
|
||||
period = MAX_PERIOD;
|
||||
period = MAX_PERIOD * 2;
|
||||
dir = 0;
|
||||
|
||||
while (1) {
|
||||
pwm_pin_set_values(pwm_dev, 0, period, period);
|
||||
if (pwm_pin_set_period(pwm_dev, 0, period)) {
|
||||
printk("set period fails\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pwm_pin_set_values(pwm_dev, 0, 0,
|
||||
(period * HW_CLOCK_CYCLES_PER_USEC) / 2)) {
|
||||
printk("set values fails\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dir) {
|
||||
period *= 2;
|
||||
|
||||
if (period > MAX_PERIOD) {
|
||||
if (period > (MAX_PERIOD * 2)) {
|
||||
dir = 0;
|
||||
period = MAX_PERIOD;
|
||||
period = MAX_PERIOD * 2;
|
||||
}
|
||||
} else {
|
||||
period /= 2;
|
||||
|
||||
if (period < MIN_PERIOD) {
|
||||
if (period < (MIN_PERIOD * 2)) {
|
||||
dir = 1;
|
||||
period = MIN_PERIOD;
|
||||
period = MIN_PERIOD * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,4 +3,3 @@ CONFIG_PRINTK=y
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_0_DEFAULT_CFG=0x14
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -41,8 +41,13 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#include <device.h>
|
||||
#include <gpio.h>
|
||||
@@ -120,7 +125,7 @@ void apds9960_reg_write(struct device *i2c_dev,
|
||||
|
||||
ret = i2c_transfer(i2c_dev, &msg, 1, APDS9960_ADDR);
|
||||
if (ret) {
|
||||
SYS_LOG_ERR("Cannot write APDS9960 reg 0x%X to 0x%X",
|
||||
PRINT("Cannot write APDS9960 reg 0x%X to 0x%X\n",
|
||||
reg_addr, reg_val);
|
||||
|
||||
while (ret) {
|
||||
@@ -149,7 +154,7 @@ void apds9960_reg_read(struct device *i2c_dev, uint8_t reg_addr,
|
||||
|
||||
ret = i2c_transfer(i2c_dev, msgs, 2, APDS9960_ADDR);
|
||||
if (ret) {
|
||||
SYS_LOG_ERR("Cannot read from APDS9960 reg 0x%X", reg_addr);
|
||||
PRINT("Cannot read from APDS9960 reg 0x%X\n", reg_addr);
|
||||
|
||||
while (ret) {
|
||||
/* spin if error */
|
||||
@@ -200,7 +205,7 @@ void main(void)
|
||||
|
||||
gpio_dev = device_get_binding(GPIO_DRV_NAME);
|
||||
if (!gpio_dev) {
|
||||
SYS_LOG_ERR("Cannot find %s!", GPIO_DRV_NAME);
|
||||
PRINT("Cannot find %s!\n", GPIO_DRV_NAME);
|
||||
|
||||
while (!gpio_dev) {
|
||||
/* spin if error */
|
||||
@@ -209,7 +214,7 @@ void main(void)
|
||||
|
||||
i2c_dev = device_get_binding(I2C_DRV_NAME);
|
||||
if (!i2c_dev) {
|
||||
SYS_LOG_ERR("Cannot find %s!", I2C_DRV_NAME);
|
||||
PRINT("Cannot find %s!\n", I2C_DRV_NAME);
|
||||
|
||||
while (!i2c_dev) {
|
||||
/* spin if error */
|
||||
@@ -221,14 +226,12 @@ void main(void)
|
||||
*/
|
||||
ret = gpio_pin_configure(gpio_dev, GPIO_DATA_PIN, (GPIO_DIR_OUT));
|
||||
if (ret) {
|
||||
SYS_LOG_ERR("Error configuring " GPIO_NAME "%d!",
|
||||
GPIO_DATA_PIN);
|
||||
PRINT("Error configuring " GPIO_NAME "%d!\n", GPIO_DATA_PIN);
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure(gpio_dev, GPIO_CLK_PIN, (GPIO_DIR_OUT));
|
||||
if (ret) {
|
||||
SYS_LOG_ERR("Error configuring " GPIO_NAME "%d!",
|
||||
GPIO_CLK_PIN);
|
||||
PRINT("Error configuring " GPIO_NAME "%d!\n", GPIO_CLK_PIN);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -253,7 +256,7 @@ void main(void)
|
||||
}
|
||||
|
||||
apds9960_setup(i2c_dev, als_gain);
|
||||
SYS_LOG_INF("GAIN ==> %d", als_gain);
|
||||
PRINT("GAIN ==> %d\n", als_gain);
|
||||
} else if ((rgbc.ch.cdatah > 0xEF) && (als_gain != 0)) {
|
||||
/* Less gain if too bright */
|
||||
als_gain--;
|
||||
@@ -262,7 +265,7 @@ void main(void)
|
||||
}
|
||||
|
||||
apds9960_setup(i2c_dev, als_gain);
|
||||
SYS_LOG_INF("GAIN ==> %d", als_gain);
|
||||
PRINT("GAIN ==> %d\n", als_gain);
|
||||
} else {
|
||||
/* Only program the LED when gain settles.
|
||||
* Or else the LED would suddenly go all
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_FLASH=y
|
||||
CONFIG_SOC_FLASH_NRF5=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
#include <zephyr.h>
|
||||
#include <flash.h>
|
||||
#include <device.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
/* Offset between pages */
|
||||
#define FLASH_TEST_OFFSET 0x40000
|
||||
@@ -41,83 +45,79 @@ void main(void)
|
||||
uint32_t buf_word = 0;
|
||||
uint32_t i, offset;
|
||||
|
||||
SYS_LOG_INF("\nNordic nRF5 Flash Testing");
|
||||
SYS_LOG_INF("=========================");
|
||||
PRINT("\nNordic nRF5 Flash Testing\n");
|
||||
PRINT("=========================\n");
|
||||
|
||||
flash_dev = device_get_binding("NRF5_FLASH");
|
||||
|
||||
if (!flash_dev) {
|
||||
SYS_LOG_ERR("Nordic nRF5 flash driver was not found!");
|
||||
PRINT("Nordic nRF5 flash driver was not found!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SYS_LOG_INF("\nTest 1: Flash erase page at 0x%x", FLASH_TEST_OFFSET);
|
||||
PRINT("\nTest 1: Flash erase page at 0x%x\n", FLASH_TEST_OFFSET);
|
||||
if (flash_erase(flash_dev, FLASH_TEST_OFFSET, FLASH_PAGE_SIZE) != 0) {
|
||||
SYS_LOG_INF(" Flash erase failed!");
|
||||
PRINT(" Flash erase failed!\n");
|
||||
} else {
|
||||
SYS_LOG_INF(" Flash erase succeeded!");
|
||||
PRINT(" Flash erase succeeded!\n");
|
||||
}
|
||||
|
||||
SYS_LOG_INF("\nTest 2: Flash write (word array 1)");
|
||||
PRINT("\nTest 2: Flash write (word array 1)\n");
|
||||
flash_write_protection_set(flash_dev, false);
|
||||
for (i = 0; i < TEST_DATA_LEN; i++) {
|
||||
offset = FLASH_TEST_OFFSET + (i << 2);
|
||||
SYS_LOG_INF(" Attempted to write %x at 0x%x",
|
||||
buf_array_1[i], offset);
|
||||
PRINT(" Attempted to write %x at 0x%x\n", buf_array_1[i],
|
||||
offset);
|
||||
if (flash_write(flash_dev, offset, &buf_array_1[i],
|
||||
TEST_DATA_LEN) != 0) {
|
||||
SYS_LOG_INF(" Flash write failed!");
|
||||
PRINT(" Flash write failed!\n");
|
||||
return;
|
||||
}
|
||||
SYS_LOG_INF(" Attempted to read 0x%x", offset);
|
||||
PRINT(" Attempted to read 0x%x\n", offset);
|
||||
if (flash_read(flash_dev, offset, &buf_word,
|
||||
TEST_DATA_LEN) != 0) {
|
||||
SYS_LOG_INF(" Flash read failed!");
|
||||
PRINT(" Flash read failed!\n");
|
||||
return;
|
||||
}
|
||||
SYS_LOG_INF(" Data read: %x", buf_word);
|
||||
PRINT(" Data read: %x\n", buf_word);
|
||||
if (buf_array_1[i] == buf_word) {
|
||||
SYS_LOG_INF(" Data read matches data written. "
|
||||
"Good!");
|
||||
PRINT(" Data read matches data written. Good!\n");
|
||||
} else {
|
||||
SYS_LOG_INF(" Data read does not match data "
|
||||
"written!");
|
||||
PRINT(" Data read does not match data written!\n");
|
||||
}
|
||||
}
|
||||
flash_write_protection_set(flash_dev, true);
|
||||
|
||||
offset = FLASH_TEST_OFFSET - FLASH_PAGE_SIZE * 2;
|
||||
SYS_LOG_INF("\nTest 3: Flash erase (4 pages at 0x%x)", offset);
|
||||
PRINT("\nTest 3: Flash erase (4 pages at 0x%x)\n", offset);
|
||||
if (flash_erase(flash_dev, offset, FLASH_PAGE_SIZE * 4) != 0) {
|
||||
SYS_LOG_INF(" Flash erase failed!");
|
||||
PRINT(" Flash erase failed!\n");
|
||||
} else {
|
||||
SYS_LOG_INF(" Flash erase succeeded!");
|
||||
PRINT(" Flash erase succeeded!\n");
|
||||
}
|
||||
|
||||
SYS_LOG_INF("\nTest 4: Flash write (word array 2)");
|
||||
PRINT("\nTest 4: Flash write (word array 2)\n");
|
||||
flash_write_protection_set(flash_dev, false);
|
||||
for (i = 0; i < TEST_DATA_LEN; i++) {
|
||||
offset = FLASH_TEST_OFFSET + (i << 2);
|
||||
SYS_LOG_INF(" Attempted to write %x at 0x%x",
|
||||
buf_array_2[i], offset);
|
||||
PRINT(" Attempted to write %x at 0x%x\n", buf_array_2[i],
|
||||
offset);
|
||||
if (flash_write(flash_dev, offset, &buf_array_2[i],
|
||||
TEST_DATA_LEN) != 0) {
|
||||
SYS_LOG_INF(" Flash write failed!");
|
||||
PRINT(" Flash write failed!\n");
|
||||
return;
|
||||
}
|
||||
SYS_LOG_INF(" Attempted to read 0x%x", offset);
|
||||
PRINT(" Attempted to read 0x%x\n", offset);
|
||||
if (flash_read(flash_dev, offset, &buf_word,
|
||||
TEST_DATA_LEN) != 0) {
|
||||
SYS_LOG_INF(" Flash read failed!");
|
||||
PRINT(" Flash read failed!\n");
|
||||
return;
|
||||
}
|
||||
SYS_LOG_INF(" Data read: %x", buf_word);
|
||||
PRINT(" Data read: %x\n", buf_word);
|
||||
if (buf_array_2[i] == buf_word) {
|
||||
SYS_LOG_INF(" Data read matches data written. "
|
||||
"Good!");
|
||||
PRINT(" Data read matches data written. Good!\n");
|
||||
} else {
|
||||
SYS_LOG_INF(" Data read does not match data "
|
||||
"written!");
|
||||
PRINT(" Data read does not match data written!\n");
|
||||
}
|
||||
}
|
||||
flash_write_protection_set(flash_dev, true);
|
||||
|
||||
@@ -4,4 +4,3 @@ CONFIG_SPI=y
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_SPI_CS_GPIO=y
|
||||
CONFIG_SPI_0_CS_GPIO_PIN=24
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -17,8 +17,13 @@
|
||||
#include <zephyr.h>
|
||||
#include <flash.h>
|
||||
#include <device.h>
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#define FLASH_TEST_REGION_OFFSET 0xff000
|
||||
#define FLASH_SECTOR_SIZE 4096
|
||||
@@ -31,13 +36,13 @@ void main(void)
|
||||
struct device *flash_dev;
|
||||
uint8_t buf[TEST_DATA_LEN];
|
||||
|
||||
SYS_LOG_INF("\nW25QXXDV SPI flash testing");
|
||||
SYS_LOG_INF("==========================");
|
||||
PRINT("\nW25QXXDV SPI flash testing\n");
|
||||
PRINT("==========================\n");
|
||||
|
||||
flash_dev = device_get_binding("W25QXXDV");
|
||||
|
||||
if (!flash_dev) {
|
||||
SYS_LOG_ERR("SPI flash driver was not found!");
|
||||
PRINT("SPI flash driver was not found!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,39 +51,38 @@ void main(void)
|
||||
* on write protection automatically after completion of write and
|
||||
* erase operations.
|
||||
*/
|
||||
SYS_LOG_INF("\nTest 1: Flash erase");
|
||||
PRINT("\nTest 1: Flash erase\n");
|
||||
flash_write_protection_set(flash_dev, false);
|
||||
if (flash_erase(flash_dev,
|
||||
FLASH_TEST_REGION_OFFSET,
|
||||
FLASH_SECTOR_SIZE) != 0) {
|
||||
SYS_LOG_INF(" Flash erase failed!");
|
||||
PRINT(" Flash erase failed!\n");
|
||||
} else {
|
||||
SYS_LOG_INF(" Flash erase succeeded!");
|
||||
PRINT(" Flash erase succeeded!\n");
|
||||
}
|
||||
|
||||
SYS_LOG_INF("\nTest 2: Flash write");
|
||||
PRINT("\nTest 2: Flash write\n");
|
||||
flash_write_protection_set(flash_dev, false);
|
||||
|
||||
buf[0] = TEST_DATA_BYTE_0;
|
||||
buf[1] = TEST_DATA_BYTE_1;
|
||||
SYS_LOG_INF(" Attempted to write %x %x", buf[0], buf[1]);
|
||||
PRINT(" Attempted to write %x %x\n", buf[0], buf[1]);
|
||||
if (flash_write(flash_dev, FLASH_TEST_REGION_OFFSET, buf,
|
||||
TEST_DATA_LEN) != 0) {
|
||||
SYS_LOG_INF(" Flash write failed!");
|
||||
PRINT(" Flash write failed!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (flash_read(flash_dev, FLASH_TEST_REGION_OFFSET, buf,
|
||||
TEST_DATA_LEN) != 0) {
|
||||
SYS_LOG_INF(" Flash read failed!");
|
||||
PRINT(" Flash read failed!\n");
|
||||
return;
|
||||
}
|
||||
SYS_LOG_INF(" Data read %x %x", buf[0], buf[1]);
|
||||
PRINT(" Data read %x %x\n", buf[0], buf[1]);
|
||||
|
||||
if ((buf[0] == TEST_DATA_BYTE_0) && (buf[1] == TEST_DATA_BYTE_1)) {
|
||||
SYS_LOG_INF(" Data read matches with data written. Good!!");
|
||||
PRINT(" Data read matches with data written. Good!!\n");
|
||||
} else {
|
||||
SYS_LOG_INF(" Data read does not match with data "
|
||||
"written!!");
|
||||
PRINT(" Data read does not match with data written!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <spi.h>
|
||||
#define SPI_DRV_NAME "SPI_0"
|
||||
@@ -66,37 +63,36 @@ struct spi_config spi_conf = {
|
||||
|
||||
static void _spi_show(struct spi_config *spi_conf)
|
||||
{
|
||||
SYS_LOG_INF("SPI Configuration:");
|
||||
SYS_LOG_INF("\tbits per word: %u",
|
||||
SPI_WORD_SIZE_GET(spi_conf->config));
|
||||
SYS_LOG_INF("\tMode: %u", SPI_MODE(spi_conf->config));
|
||||
SYS_LOG_INF("\tMax speed Hz: 0x%X", spi_conf->max_sys_freq);
|
||||
PRINT("SPI Configuration:\n");
|
||||
PRINT("\tbits per word: %u\n", SPI_WORD_SIZE_GET(spi_conf->config));
|
||||
PRINT("\tMode: %u\n", SPI_MODE(spi_conf->config));
|
||||
PRINT("\tMax speed Hz: 0x%X\n", spi_conf->max_sys_freq);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
struct device *spi;
|
||||
|
||||
SYS_LOG_INF("==== SPI Test Application ====");
|
||||
PRINT("==== SPI Test Application ====\n");
|
||||
|
||||
spi = device_get_binding(SPI_DRV_NAME);
|
||||
|
||||
SYS_LOG_INF("Running...");
|
||||
PRINT("Running...\n");
|
||||
|
||||
spi_configure(spi, &spi_conf);
|
||||
spi_slave_select(spi, SPI_SLAVE);
|
||||
|
||||
_spi_show(&spi_conf);
|
||||
|
||||
SYS_LOG_INF("Writing...");
|
||||
PRINT("Writing...\n");
|
||||
spi_write(spi, (uint8_t *) wbuf, 6);
|
||||
|
||||
SYS_LOG_INF("SPI sent: %s", wbuf);
|
||||
PRINT("SPI sent: %s\n", wbuf);
|
||||
print_buf_hex(rbuf, 6);
|
||||
|
||||
strcpy(wbuf, "So what then?");
|
||||
spi_transceive(spi, wbuf, 14, rbuf, 16);
|
||||
|
||||
SYS_LOG_INF("SPI transceived: %s", rbuf);
|
||||
PRINT("SPI transceived: %s\n", rbuf);
|
||||
print_buf_hex(rbuf, 6);
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -16,10 +16,15 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
{
|
||||
SYS_LOG_INF("Hello World! %s", CONFIG_ARCH);
|
||||
PRINT("Hello World! %s\n", CONFIG_ARCH);
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
# nothing yet
|
||||
|
||||
@@ -15,8 +15,15 @@
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* @file
|
||||
@@ -27,6 +34,6 @@
|
||||
|
||||
void main(void)
|
||||
{
|
||||
SYS_LOG_INF("Hello World! %s", CONFIG_ARCH);
|
||||
PRINT("Hello World! %s\n", CONFIG_ARCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_NETWORKING_WITH_BT=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
|
||||
@@ -16,13 +16,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_TINYDTLS_DEBUG)
|
||||
#define DEBUG DEBUG_FULL
|
||||
#else
|
||||
#define DEBUG DEBUG_SYS_LOG_INF
|
||||
#define DEBUG DEBUG_PRINT
|
||||
#endif
|
||||
#include "contiki/ip/uip-debug.h"
|
||||
|
||||
@@ -96,7 +101,7 @@ static struct in_addr in4addr_my = MY_IPADDR;
|
||||
|
||||
static inline void init_app(void)
|
||||
{
|
||||
SYS_LOG_INF("%s: run coap observe client", __func__);
|
||||
PRINT("%s: run coap observe client\n", __func__);
|
||||
|
||||
#if defined(CONFIG_NET_TESTING)
|
||||
net_testing_setup();
|
||||
@@ -209,30 +214,29 @@ static void notification_callback(coap_observee_t *obs, void *notification,
|
||||
int len = 0;
|
||||
const uint8_t *payload = NULL;
|
||||
|
||||
SYS_LOG_INF("Notification handler");
|
||||
SYS_LOG_INF("Observee URI: %s", obs->url);
|
||||
PRINT("Notification handler\n");
|
||||
PRINT("Observee URI: %s\n", obs->url);
|
||||
if(notification) {
|
||||
len = coap_get_payload(notification, &payload);
|
||||
}
|
||||
switch(flag) {
|
||||
case NOTIFICATION_OK:
|
||||
SYS_LOG_INF("NOTIFICATION OK: %*s", len, (char *)payload);
|
||||
PRINT("NOTIFICATION OK: %*s\n", len, (char *)payload);
|
||||
break;
|
||||
case OBSERVE_OK: /* server accepeted observation request */
|
||||
SYS_LOG_INF("OBSERVE_OK: %*s", len, (char *)payload);
|
||||
PRINT("OBSERVE_OK: %*s\n", len, (char *)payload);
|
||||
break;
|
||||
case OBSERVE_NOT_SUPPORTED:
|
||||
SYS_LOG_INF("OBSERVE_NOT_SUPPORTED: %*s", len,
|
||||
(char *)payload);
|
||||
PRINT("OBSERVE_NOT_SUPPORTED: %*s\n", len, (char *)payload);
|
||||
obs = NULL;
|
||||
break;
|
||||
case ERROR_RESPONSE_CODE:
|
||||
SYS_LOG_INF("ERROR_RESPONSE_CODE: %*s", len, (char *)payload);
|
||||
PRINT("ERROR_RESPONSE_CODE: %*s\n", len, (char *)payload);
|
||||
obs = NULL;
|
||||
break;
|
||||
case NO_REPLY_FROM_SERVER:
|
||||
SYS_LOG_INF("NO_REPLY_FROM_SERVER: "
|
||||
"removing observe registration with token %x%x",
|
||||
PRINT("NO_REPLY_FROM_SERVER: "
|
||||
"removing observe registration with token %x%x\n",
|
||||
obs->token[0], obs->token[1]);
|
||||
obs = NULL;
|
||||
break;
|
||||
@@ -245,11 +249,11 @@ static void notification_callback(coap_observee_t *obs, void *notification,
|
||||
void toggle_observation(coap_context_t *coap_ctx)
|
||||
{
|
||||
if(obs) {
|
||||
SYS_LOG_INF("Stopping observation");
|
||||
PRINT("Stopping observation\n");
|
||||
coap_obs_remove_observee(obs);
|
||||
obs = NULL;
|
||||
} else {
|
||||
SYS_LOG_INF("Starting observation");
|
||||
PRINT("Starting observation\n");
|
||||
obs = coap_obs_request_registration(coap_ctx,
|
||||
(uip_ipaddr_t *)&in6addr_peer,
|
||||
PEER_PORT,
|
||||
@@ -295,7 +299,7 @@ void startup(void)
|
||||
|
||||
#if defined(CONFIG_NETWORKING_WITH_BT)
|
||||
if (bt_enable(NULL)) {
|
||||
SYS_LOG_INF("Bluetooth init failed");
|
||||
PRINT("Bluetooth init failed\n");
|
||||
return;
|
||||
}
|
||||
ipss_init();
|
||||
@@ -304,7 +308,7 @@ void startup(void)
|
||||
|
||||
coap_ctx = coap_context_new((uip_ipaddr_t *)&in6addr_my, MY_PORT);
|
||||
if (!coap_ctx) {
|
||||
SYS_LOG_INF("Cannot get CoAP context.");
|
||||
PRINT("Cannot get CoAP context.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -316,7 +320,7 @@ void startup(void)
|
||||
if (!coap_context_connect(coap_ctx,
|
||||
(uip_ipaddr_t *)&in6addr_peer,
|
||||
PEER_PORT)) {
|
||||
SYS_LOG_INF("Cannot connect to peer.");
|
||||
PRINT("Cannot connect to peer.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -325,16 +329,16 @@ void startup(void)
|
||||
|
||||
while (1) {
|
||||
while (!coap_context_is_connected(coap_ctx)) {
|
||||
SYS_LOG_INF("Trying to connect to peer...");
|
||||
PRINT("Trying to connect to peer...\n");
|
||||
if (!coap_context_wait_data(coap_ctx, WAIT_TICKS)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(first_round || etimer_expired(&et)) {
|
||||
SYS_LOG_INF("--Toggle timer--");
|
||||
PRINT("--Toggle timer--\n");
|
||||
toggle_observation(coap_ctx);
|
||||
SYS_LOG_INF("--Done--");
|
||||
PRINT("--Done--\n");
|
||||
etimer_restart(&et);
|
||||
first_round = false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_IP_BUF_RX_SIZE=3
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_NETWORKING_WITH_BT=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
|
||||
@@ -16,13 +16,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_TINYDTLS_DEBUG)
|
||||
#define DEBUG DEBUG_FULL
|
||||
#else
|
||||
#define DEBUG DEBUG_SYS_LOG_INF
|
||||
#define DEBUG DEBUG_PRINT
|
||||
#endif
|
||||
#include "contiki/ip/uip-debug.h"
|
||||
|
||||
@@ -71,7 +76,7 @@ char fiberStack[STACKSIZE];
|
||||
|
||||
static inline void init_app(void)
|
||||
{
|
||||
SYS_LOG_INF("%s: run coap server", __func__);
|
||||
PRINT("%s: run coap server\n", __func__);
|
||||
|
||||
#if defined(CONFIG_NET_TESTING)
|
||||
net_testing_setup();
|
||||
@@ -225,12 +230,12 @@ void startup(void)
|
||||
my_addr.family = AF_INET;
|
||||
#endif
|
||||
|
||||
SYS_LOG_INF("Starting ETSI IoT Plugtests Server");
|
||||
PRINT("Starting ETSI IoT Plugtests Server\n");
|
||||
|
||||
SYS_LOG_INF("uIP buffer: %u", UIP_BUFSIZE);
|
||||
SYS_LOG_INF("LL header: %u", UIP_LLH_LEN);
|
||||
SYS_LOG_INF("IP+UDP header: %u", UIP_IPUDPH_LEN);
|
||||
SYS_LOG_INF("REST max chunk: %u", REST_MAX_CHUNK_SIZE);
|
||||
PRINT("uIP buffer: %u\n", UIP_BUFSIZE);
|
||||
PRINT("LL header: %u\n", UIP_LLH_LEN);
|
||||
PRINT("IP+UDP header: %u\n", UIP_IPUDPH_LEN);
|
||||
PRINT("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE);
|
||||
|
||||
net_init();
|
||||
|
||||
@@ -244,7 +249,7 @@ void startup(void)
|
||||
|
||||
#if defined(CONFIG_NETWORKING_WITH_BT)
|
||||
if (bt_enable(NULL)) {
|
||||
SYS_LOG_INF("Bluetooth init failed");
|
||||
PRINT("Bluetooth init failed\n");
|
||||
return;
|
||||
}
|
||||
ipss_init();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
#
|
||||
#console
|
||||
#
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <sections.h>
|
||||
@@ -30,19 +35,18 @@
|
||||
|
||||
static void dhcpc_configured_cb(void)
|
||||
{
|
||||
SYS_LOG_INF("%s", __func__);
|
||||
SYS_LOG_INF("Got IP address %d.%d.%d.%d",
|
||||
uip_ipaddr_to_quad(&uip_hostaddr));
|
||||
PRINT("%s\n", __func__);
|
||||
PRINT("Got IP address %d.%d.%d.%d\n", uip_ipaddr_to_quad(&uip_hostaddr));
|
||||
}
|
||||
|
||||
static void dhcpc_unconfigured_cb(void)
|
||||
{
|
||||
SYS_LOG_INF("%s", __func__);
|
||||
PRINT("%s\n", __func__);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
SYS_LOG_INF("run dhcp client");
|
||||
PRINT("run dhcp client\n");
|
||||
dhcpc_set_callbacks(dhcpc_configured_cb, dhcpc_unconfigured_cb);
|
||||
net_init();
|
||||
}
|
||||
|
||||
17
samples/net/dns_client/KNOWN_ISSUES
Normal file
17
samples/net/dns_client/KNOWN_ISSUES
Normal file
@@ -0,0 +1,17 @@
|
||||
Issues
|
||||
------
|
||||
|
||||
- RX or TX error:
|
||||
Caused by:
|
||||
net_send error, see:
|
||||
https://jira.zephyrproject.org/browse/ZEP-428
|
||||
https://jira.zephyrproject.org/browse/ZEP-676
|
||||
|
||||
Workaround:
|
||||
Wait until the IP stack is "activated"
|
||||
or reset the board.
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
See the ./README_API file.
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
|
||||
@@ -16,13 +16,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_TINYDTLS_DEBUG)
|
||||
#define DEBUG DEBUG_FULL
|
||||
#else
|
||||
#define DEBUG DEBUG_SYS_LOG_INF
|
||||
#define DEBUG DEBUG_PRINT
|
||||
#endif
|
||||
#include "contiki/ip/uip-debug.h"
|
||||
|
||||
@@ -96,7 +101,7 @@ static const unsigned char ecdsa_pub_key_y[] = {
|
||||
|
||||
static inline void init_app(void)
|
||||
{
|
||||
SYS_LOG_INF("%s: run dtls client", __func__);
|
||||
PRINT("%s: run dtls client\n", __func__);
|
||||
|
||||
#if defined(CONFIG_NET_TESTING)
|
||||
net_testing_setup();
|
||||
@@ -157,7 +162,7 @@ static inline bool wait_reply(const char *name,
|
||||
/* Wait for the answer */
|
||||
buf = net_receive(user_data->ctx, WAIT_TICKS);
|
||||
if (buf) {
|
||||
SYS_LOG_INF("Received data %p datalen %d",
|
||||
PRINT("Received data %p datalen %d\n",
|
||||
ip_buf_appdata(buf), ip_buf_appdatalen(buf));
|
||||
|
||||
dtls_handle_message(dtls, session, ip_buf_appdata(buf),
|
||||
@@ -204,7 +209,7 @@ static inline struct net_context *get_context(void)
|
||||
&peer_addr, PEER_PORT,
|
||||
&my_addr, MY_PORT);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -218,10 +223,10 @@ static int read_from_peer(struct dtls_context_t *ctx,
|
||||
struct data *user_data = (struct data *)dtls_get_app_data(ctx);
|
||||
int pos;
|
||||
|
||||
SYS_LOG_INF("%s: read from peer %p len %d", __func__, data, len);
|
||||
PRINT("%s: read from peer %p len %d\n", __func__, data, len);
|
||||
|
||||
if (user_data->expecting != len) {
|
||||
SYS_LOG_INF("%s: received %d bytes, expected %d",
|
||||
PRINT("%s: received %d bytes, expected %d\n",
|
||||
__func__, len, user_data->expecting);
|
||||
user_data->fail = true;
|
||||
return 0;
|
||||
@@ -237,7 +242,7 @@ static int read_from_peer(struct dtls_context_t *ctx,
|
||||
pos = user_data->ipsum_len - user_data->expecting;
|
||||
|
||||
if (memcmp(lorem_ipsum + pos, data, user_data->expecting)) {
|
||||
SYS_LOG_INF("%s: received data mismatch.", __func__);
|
||||
PRINT("%s: received data mismatch.\n", __func__);
|
||||
user_data->fail = true;
|
||||
}
|
||||
|
||||
@@ -261,12 +266,11 @@ static int send_to_peer(struct dtls_context_t *ctx,
|
||||
|
||||
max_data_len = IP_BUF_MAX_DATA - UIP_IPUDPH_LEN;
|
||||
|
||||
SYS_LOG_INF("%s: send to peer data %p len %d", __func__, data, len);
|
||||
PRINT("%s: send to peer data %p len %d\n", __func__, data, len);
|
||||
|
||||
if (len > max_data_len) {
|
||||
SYS_LOG_INF("%s: too much (%d bytes) data "
|
||||
"to send (max %d bytes)",
|
||||
__func__, len, max_data_len);
|
||||
PRINT("%s: too much (%d bytes) data to send (max %d bytes)\n",
|
||||
__func__, len, max_data_len);
|
||||
ip_buf_unref(buf);
|
||||
len = -EINVAL;
|
||||
goto out;
|
||||
@@ -372,7 +376,7 @@ static int handle_event(struct dtls_context_t *ctx, session_t *session,
|
||||
struct data *user_data =
|
||||
(struct data *)dtls_get_app_data(ctx);
|
||||
|
||||
SYS_LOG_INF("*** Connected ***");
|
||||
PRINT("*** Connected ***\n");
|
||||
|
||||
/* We can send data now */
|
||||
user_data->connected = true;
|
||||
@@ -397,7 +401,7 @@ static void init_dtls(struct data *user_data, dtls_context_t **dtls)
|
||||
#endif /* DTLS_ECC */
|
||||
};
|
||||
|
||||
SYS_LOG_INF("DTLS client started");
|
||||
PRINT("DTLS client started\n");
|
||||
|
||||
#ifdef CONFIG_TINYDTLS_DEBUG
|
||||
dtls_set_log_level(DTLS_LOG_DEBUG);
|
||||
@@ -425,13 +429,13 @@ void startup(void)
|
||||
|
||||
user_data.ctx = get_context();
|
||||
if (!user_data.ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
init_dtls(&user_data, &dtls);
|
||||
if (!dtls) {
|
||||
SYS_LOG_INF("%s: Cannot get DTLS context", __func__);
|
||||
PRINT("%s: Cannot get DTLS context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -440,9 +444,9 @@ void startup(void)
|
||||
uip_ipaddr_copy(&session.addr.ipaddr, (uip_ipaddr_t *)&in6addr_peer);
|
||||
session.addr.port = uip_htons(PEER_PORT);
|
||||
|
||||
PRINT("Trying to connect to ");
|
||||
PRINT6ADDR(&session.addr.ipaddr);
|
||||
SYS_LOG_INF("Trying to connect to :%d",
|
||||
uip_ntohs(session.addr.port));
|
||||
PRINTF(":%d\n", uip_ntohs(session.addr.port));
|
||||
|
||||
dtls_connect(dtls, &session);
|
||||
|
||||
@@ -457,7 +461,7 @@ void startup(void)
|
||||
}
|
||||
}
|
||||
|
||||
SYS_LOG_INF("ERROR: Did not receive reply, closing.");
|
||||
PRINT("ERROR: Did not receive reply, closing.\n");
|
||||
dtls_close(dtls, &session);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_IP_BUF_RX_SIZE=3
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_NETWORKING_WITH_BT=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_NETWORKING=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_NETWORKING=y
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
@@ -58,7 +63,7 @@ static const unsigned char ecdsa_pub_key_y[] = {
|
||||
|
||||
static inline void init_app(void)
|
||||
{
|
||||
SYS_LOG_INF("%s: run dtls server", __func__);
|
||||
PRINT("%s: run dtls server\n", __func__);
|
||||
|
||||
#if defined(CONFIG_NET_TESTING)
|
||||
net_testing_setup();
|
||||
@@ -100,7 +105,7 @@ static inline void receive_message(const char *name,
|
||||
&NET_BUF_IP(buf)->srcipaddr);
|
||||
session.addr.port = NET_BUF_UDP(buf)->srcport;
|
||||
|
||||
SYS_LOG_INF("Received data %p datalen %d",
|
||||
PRINT("Received data %p datalen %d\n",
|
||||
ip_buf_appdata(buf), ip_buf_appdatalen(buf));
|
||||
|
||||
dtls_handle_message(dtls, &session, ip_buf_appdata(buf),
|
||||
@@ -148,7 +153,7 @@ static inline struct net_context *get_context(void)
|
||||
&any_addr, 0,
|
||||
&my_addr, MY_PORT);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -159,7 +164,7 @@ static int read_from_peer(struct dtls_context_t *ctx,
|
||||
session_t *session,
|
||||
uint8 *data, size_t len)
|
||||
{
|
||||
SYS_LOG_INF("%s: read from peer %p len %d", __func__, data, len);
|
||||
PRINT("%s: read from peer %p len %d\n", __func__, data, len);
|
||||
|
||||
/* In this test we reverse the received bytes.
|
||||
* We could also just pass the data back as is.
|
||||
@@ -189,12 +194,11 @@ static int send_to_peer(struct dtls_context_t *ctx,
|
||||
max_data_len = IP_BUF_MAX_DATA - sizeof(struct uip_udp_hdr) -
|
||||
sizeof(struct uip_ip_hdr);
|
||||
|
||||
SYS_LOG_INF("%s: reply to peer data %p len %d", __func__, data, len);
|
||||
PRINT("%s: reply to peer data %p len %d\n", __func__, data, len);
|
||||
|
||||
if (len > max_data_len) {
|
||||
SYS_LOG_INF("%s: too much (%d bytes) data to "
|
||||
"send (max %d bytes)",
|
||||
__func__, len, max_data_len);
|
||||
PRINT("%s: too much (%d bytes) data to send (max %d bytes)\n",
|
||||
__func__, len, max_data_len);
|
||||
ip_buf_unref(buf);
|
||||
len = -EINVAL;
|
||||
goto out;
|
||||
@@ -317,7 +321,7 @@ static int handle_event(struct dtls_context_t *ctx, session_t *session,
|
||||
} else if (level == 0) {
|
||||
/* internal event */
|
||||
if (code == DTLS_EVENT_CONNECTED) {
|
||||
SYS_LOG_INF("*** Connected ***");
|
||||
PRINT("*** Connected ***\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +343,7 @@ static void init_dtls(struct net_context *recv, dtls_context_t **dtls)
|
||||
#endif /* DTLS_ECC */
|
||||
};
|
||||
|
||||
SYS_LOG_INF("DTLS server started");
|
||||
PRINT("DTLS server started\n");
|
||||
|
||||
#if defined(CONFIG_TINYDTLS_DEBUG)
|
||||
dtls_set_log_level(DTLS_LOG_DEBUG);
|
||||
@@ -364,7 +368,7 @@ void startup(void)
|
||||
|
||||
#if defined(CONFIG_NETWORKING_WITH_BT)
|
||||
if (bt_enable(NULL)) {
|
||||
SYS_LOG_INF("Bluetooth init failed");
|
||||
PRINT("Bluetooth init failed\n");
|
||||
return;
|
||||
}
|
||||
ipss_init();
|
||||
@@ -373,13 +377,13 @@ void startup(void)
|
||||
|
||||
recv = get_context();
|
||||
if (!recv) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
init_dtls(recv, &dtls);
|
||||
if (!dtls) {
|
||||
SYS_LOG_INF("%s: Cannot get DTLS context", __func__);
|
||||
PRINT("%s: Cannot get DTLS context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_IP_BUF_RX_SIZE=2
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
|
||||
@@ -23,8 +23,13 @@
|
||||
* back to the originator.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <sections.h>
|
||||
@@ -116,7 +121,7 @@ static struct net_context *unicast, *multicast;
|
||||
|
||||
static inline void init_app(void)
|
||||
{
|
||||
SYS_LOG_INF("%s: run mcast tester", __func__);
|
||||
PRINT("%s: run mcast tester\n", __func__);
|
||||
|
||||
sys_rand32_init();
|
||||
|
||||
@@ -161,24 +166,22 @@ static inline int send_packet(const char *name,
|
||||
/* We have a pending packet that needs to be sent
|
||||
* first.
|
||||
*/
|
||||
SYS_LOG_INF("%s: Trying to re-send %p len %d", __func__, buf,
|
||||
PRINT("%s: Trying to re-send %p len %d\n", __func__, buf,
|
||||
buf->len);
|
||||
ret = net_send(buf);
|
||||
if (ret == -EAGAIN || ret == -EINPROGRESS) {
|
||||
SYS_LOG_INF("%s: packet %p needs to be re-sent (%d)",
|
||||
PRINT("%s: packet %p needs to be re-sent (%d)\n",
|
||||
name, buf, ret);
|
||||
return ret;
|
||||
} else if (ret < 0) {
|
||||
SYS_LOG_INF("%s: returned %d pending buffer "
|
||||
"discarded %p",
|
||||
name, ret, buf);
|
||||
PRINT("%s: returned %d pending buffer discarded %p\n",
|
||||
name, ret, buf);
|
||||
ip_buf_unref(buf);
|
||||
buf = NULL;
|
||||
return ret;
|
||||
} else {
|
||||
SYS_LOG_INF("%s: returned %d pending buffer "
|
||||
"cleared %p",
|
||||
name, ret, buf);
|
||||
PRINT("%s: returned %d pending buffer cleared %p\n",
|
||||
name, ret, buf);
|
||||
buf = NULL;
|
||||
return 0;
|
||||
}
|
||||
@@ -194,26 +197,24 @@ static inline int send_packet(const char *name,
|
||||
|
||||
ip_buf_appdatalen(buf) = sending_len;
|
||||
|
||||
SYS_LOG_INF("%s: Trying to send %p buflen %d datalen %d",
|
||||
PRINT("%s: Trying to send %p buflen %d datalen %d\n",
|
||||
__func__, buf, buf->len, ip_buf_appdatalen(buf));
|
||||
ret = net_send(buf);
|
||||
if (ret < 0) {
|
||||
if (ret == -EINPROGRESS) {
|
||||
SYS_LOG_INF("%s: no connection yet,"
|
||||
" try again",
|
||||
__func__);
|
||||
PRINT("%s: no connection yet, try again\n",
|
||||
__func__);
|
||||
} else if (ret == -EAGAIN || ret == -ECONNRESET) {
|
||||
SYS_LOG_INF("%s: no connection, "
|
||||
"try again later",
|
||||
__func__);
|
||||
PRINT("%s: no connection, try again later\n",
|
||||
__func__);
|
||||
} else {
|
||||
SYS_LOG_INF("%s: sending %d bytes failed",
|
||||
PRINT("%s: sending %d bytes failed\n",
|
||||
__func__, sending_len);
|
||||
ip_buf_unref(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
} else {
|
||||
SYS_LOG_INF("%s: sent %d bytes", __func__,
|
||||
PRINT("%s: sent %d bytes\n", __func__,
|
||||
sending_len);
|
||||
buf = NULL;
|
||||
}
|
||||
@@ -241,8 +242,8 @@ again:
|
||||
if (ip_buf_appdatalen(buf) < expected_len) {
|
||||
if (memcmp(lorem_ipsum + pos, ip_buf_appdata(buf),
|
||||
ip_buf_appdatalen(buf))) {
|
||||
SYS_LOG_INF("%s: received %d bytes (total %d), "
|
||||
"partial data mismatch",
|
||||
PRINT("%s: received %d bytes (total %d), "
|
||||
"partial data mismatch\n",
|
||||
name, ip_buf_appdatalen(buf),
|
||||
expected_len);
|
||||
fail = true;
|
||||
@@ -264,26 +265,25 @@ again:
|
||||
|
||||
if (memcmp(lorem_ipsum + pos, ip_buf_appdata(buf),
|
||||
expected_len)) {
|
||||
SYS_LOG_INF("%s: received data mismatch in "
|
||||
"last packet.", name);
|
||||
PRINT("%s: received data mismatch in "
|
||||
"last packet.\n", name);
|
||||
fail = true;
|
||||
goto free_buf;
|
||||
}
|
||||
|
||||
if (total_len != sum) {
|
||||
SYS_LOG_INF("Received %d bytes, expected %d",
|
||||
PRINT("Received %d bytes, expected %d\n",
|
||||
sum, total_len);
|
||||
} else {
|
||||
SYS_LOG_INF("Received %d bytes"
|
||||
" (in %d messages)",
|
||||
total_len, count + 1);
|
||||
PRINT("Received %d bytes (in %d messages)\n",
|
||||
total_len, count + 1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
buf = net_receive(ctx, WAIT_TICKS);
|
||||
if (buf) {
|
||||
if (ip_buf_appdatalen(buf) != expected_len) {
|
||||
SYS_LOG_INF("%s: received %d bytes, expected %d",
|
||||
PRINT("%s: received %d bytes, expected %d\n",
|
||||
name, ip_buf_appdatalen(buf), expected_len);
|
||||
fail = true;
|
||||
goto free_buf;
|
||||
@@ -300,19 +300,19 @@ again:
|
||||
*/
|
||||
if (memcmp(lorem_ipsum + pos, ip_buf_appdata(buf),
|
||||
expected_len)) {
|
||||
SYS_LOG_INF("%s: received data mismatch.", name);
|
||||
PRINT("%s: received data mismatch.\n", name);
|
||||
fail = true;
|
||||
goto free_buf;
|
||||
}
|
||||
|
||||
SYS_LOG_INF("%s: received %d bytes", __func__,
|
||||
PRINT("%s: received %d bytes\n", __func__,
|
||||
expected_len);
|
||||
#endif
|
||||
|
||||
free_buf:
|
||||
ip_buf_unref(buf);
|
||||
} else {
|
||||
SYS_LOG_INF("%s: expected data, got none", name);
|
||||
PRINT("%s: expected data, got none\n", name);
|
||||
fail = true;
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ static inline bool get_context(struct net_context **unicast,
|
||||
&peer_addr, PEER_PORT,
|
||||
&my_addr, MY_PORT);
|
||||
if (!*unicast) {
|
||||
SYS_LOG_INF("%s: Cannot get sending network context",
|
||||
PRINT("%s: Cannot get sending network context\n",
|
||||
__func__);
|
||||
return false;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ static inline bool get_context(struct net_context **unicast,
|
||||
&mcast_addr, PEER_PORT,
|
||||
&my_addr, MY_PORT);
|
||||
if (!*multicast) {
|
||||
SYS_LOG_INF("%s: Cannot get mcast sending network context",
|
||||
PRINT("%s: Cannot get mcast sending network context\n",
|
||||
__func__);
|
||||
return false;
|
||||
}
|
||||
@@ -405,7 +405,7 @@ static bool sending(int resend)
|
||||
static const char *type = "Unicast";
|
||||
#endif
|
||||
|
||||
SYS_LOG_INF("%s: Sending packet", __func__);
|
||||
PRINT("%s: Sending packet\n", __func__);
|
||||
|
||||
if (resend) {
|
||||
expecting = resend;
|
||||
@@ -419,23 +419,23 @@ static bool sending(int resend)
|
||||
expecting);
|
||||
if (ret == -EAGAIN || ret == -EINPROGRESS) {
|
||||
fiber_sleep(10);
|
||||
SYS_LOG_INF("retrying...");
|
||||
PRINT("retrying...\n");
|
||||
goto again;
|
||||
} else if (ret == -ETIMEDOUT) {
|
||||
SYS_LOG_INF("Connection timed out");
|
||||
PRINT("Connection timed out\n");
|
||||
return false;
|
||||
} else if (ret < 0) {
|
||||
SYS_LOG_INF("%s sending %d bytes FAIL", type,
|
||||
PRINT("%s sending %d bytes FAIL\n", type,
|
||||
ipsum_len - expecting);
|
||||
} else {
|
||||
SYS_LOG_INF("%s sent %d bytes", type,
|
||||
PRINT("%s sent %d bytes\n", type,
|
||||
ipsum_len - expecting);
|
||||
}
|
||||
#if !defined(CONFIG_NETWORKING_WITH_TCP)
|
||||
} else {
|
||||
if (send_packet(__func__, multicast, ipsum_len,
|
||||
expecting)) {
|
||||
SYS_LOG_INF("Multicast sending %d bytes FAIL",
|
||||
PRINT("Multicast sending %d bytes FAIL\n",
|
||||
ipsum_len - expecting);
|
||||
}
|
||||
#endif
|
||||
@@ -449,16 +449,16 @@ void receiving(void)
|
||||
int expecting_len = 0;
|
||||
|
||||
while (sending(expecting_len)) {
|
||||
SYS_LOG_INF("Waiting packet");
|
||||
PRINT("Waiting packet\n");
|
||||
|
||||
if (wait_reply(__func__, unicast,
|
||||
ipsum_len, expecting)) {
|
||||
if (expecting_len > 0) {
|
||||
SYS_LOG_INF("Resend %d bytes -> FAIL",
|
||||
PRINT("Resend %d bytes -> FAIL\n",
|
||||
ipsum_len - expecting);
|
||||
expecting_len = 0;
|
||||
} else {
|
||||
SYS_LOG_INF("Waiting %d bytes -> resending",
|
||||
PRINT("Waiting %d bytes -> resending\n",
|
||||
ipsum_len - expecting);
|
||||
expecting_len = expecting;
|
||||
}
|
||||
@@ -477,7 +477,7 @@ void main(void)
|
||||
|
||||
#if defined(CONFIG_NETWORKING_WITH_BT)
|
||||
if (bt_enable(NULL)) {
|
||||
SYS_LOG_INF("Bluetooth init failed");
|
||||
PRINT("Bluetooth init failed\n");
|
||||
return;
|
||||
}
|
||||
ipss_init();
|
||||
@@ -485,7 +485,7 @@ void main(void)
|
||||
#endif
|
||||
|
||||
if (!get_context(&unicast, &multicast)) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_IP_BUF_RX_SIZE=3
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_INIT_STACKS=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_NETWORKING=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NET_TESTING=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
CONFIG_NETWORKING=y
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <sections.h>
|
||||
@@ -88,7 +93,7 @@ uip_ipaddr_t uip_netmask = { { 255, 255, 255, 0 } };
|
||||
|
||||
static inline void init_app(void)
|
||||
{
|
||||
SYS_LOG_INF("%s: run echo server", __func__);
|
||||
PRINT("%s: run echo server\n", __func__);
|
||||
|
||||
#if defined(CONFIG_NET_TESTING)
|
||||
net_testing_setup();
|
||||
@@ -115,7 +120,7 @@ static inline struct net_buf *prepare_reply(const char *name,
|
||||
struct net_buf *buf,
|
||||
int proto)
|
||||
{
|
||||
SYS_LOG_INF("%s: %sreceived %d bytes data", name, type,
|
||||
PRINT("%s: %sreceived %d bytes data\n", name, type,
|
||||
ip_buf_appdatalen(buf));
|
||||
|
||||
if (proto != IPPROTO_TCP) {
|
||||
@@ -184,13 +189,12 @@ static inline void receive_and_reply(const char *name,
|
||||
} else if (!ret) {
|
||||
tcpbuf = NULL;
|
||||
} else {
|
||||
SYS_LOG_INF("Retrying to send packet %p",
|
||||
tcpbuf);
|
||||
PRINT("Retrying to send packet %p\n", tcpbuf);
|
||||
}
|
||||
} else {
|
||||
tcpbuf = net_receive(tcp_recv, WAIT_TICKS);
|
||||
if (tcpbuf) {
|
||||
SYS_LOG_INF("Received packet %p len %d",
|
||||
PRINT("Received packet %p len %d\n",
|
||||
tcpbuf, ip_buf_appdatalen(tcpbuf));
|
||||
prepare_reply(name, "tcp ", tcpbuf, IPPROTO_TCP);
|
||||
goto reply;
|
||||
@@ -241,7 +245,7 @@ static inline bool get_context(struct net_context **udp_recv,
|
||||
&any_addr, 0,
|
||||
&my_addr, MY_PORT);
|
||||
if (!*udp_recv) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -251,8 +255,7 @@ static inline bool get_context(struct net_context **udp_recv,
|
||||
&any_addr, 0,
|
||||
&my_addr, MY_PORT);
|
||||
if (!*tcp_recv) {
|
||||
SYS_LOG_INF("%s: Cannot get network context",
|
||||
__func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -262,7 +265,7 @@ static inline bool get_context(struct net_context **udp_recv,
|
||||
&any_addr, 0,
|
||||
&mcast_addr, MY_PORT);
|
||||
if (!*mcast_recv) {
|
||||
SYS_LOG_INF("%s: Cannot get receiving mcast network context",
|
||||
PRINT("%s: Cannot get receiving mcast network context\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
@@ -280,7 +283,7 @@ void receive(void)
|
||||
static struct net_context *mcast_recv;
|
||||
|
||||
if (!get_context(&udp_recv, &tcp_recv, &mcast_recv)) {
|
||||
SYS_LOG_INF("%s: Cannot get network contexts", __func__);
|
||||
PRINT("%s: Cannot get network contexts\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -297,7 +300,7 @@ void main(void)
|
||||
|
||||
#if defined(CONFIG_NETWORKING_WITH_BT)
|
||||
if (bt_enable(NULL)) {
|
||||
SYS_LOG_INF("Bluetooth init failed");
|
||||
PRINT("Bluetooth init failed\n");
|
||||
return;
|
||||
}
|
||||
ipss_init();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOOPBACK=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOOPBACK=y
|
||||
CONFIG_NETWORKING_IPV6_NO_ND=y
|
||||
|
||||
@@ -18,8 +18,13 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#include <net/ip_buf.h>
|
||||
#include <net/net_core.h>
|
||||
@@ -93,15 +98,15 @@ int eval_rcvd_data(char *rcvd_buf, int rcvd_len)
|
||||
|
||||
if (data_len != rcvd_len) {
|
||||
rc = -1;
|
||||
SYS_LOG_INF("Received %d bytes but was sent %d bytes",
|
||||
PRINT("Received %d bytes but was sent %d bytes\n",
|
||||
rcvd_len, data_len);
|
||||
} else {
|
||||
/* Data integrity */
|
||||
rc = memcmp(text, rcvd_buf, data_len-1);
|
||||
if (rc != 0) {
|
||||
SYS_LOG_INF("Sent and received data does not match.");
|
||||
SYS_LOG_INF("Sent: %.*s", data_len, text);
|
||||
SYS_LOG_INF("Received: %.*s",
|
||||
PRINT("Sent and received data does not match.\n");
|
||||
PRINT("Sent: %.*s\n", data_len, text);
|
||||
PRINT("Received: %.*s\n",
|
||||
data_len, rcvd_buf);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +124,7 @@ void fiber_receiver(void)
|
||||
&any_addr, 0,
|
||||
&loopback_addr, 4242);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,11 +136,11 @@ void fiber_receiver(void)
|
||||
rcvd_buf = ip_buf_appdata(buf);
|
||||
rcvd_len = ip_buf_appdatalen(buf);
|
||||
|
||||
SYS_LOG_INF("[%d] %s: Received: %d bytes",
|
||||
PRINT("[%d] %s: Received: %d bytes\n",
|
||||
received, __func__, rcvd_len);
|
||||
|
||||
if (eval_rcvd_data(rcvd_buf, rcvd_len) != 0) {
|
||||
SYS_LOG_INF("[%d] %s: net_receive failed!",
|
||||
PRINT("[%d] %s: net_receive failed!\n",
|
||||
received, __func__);
|
||||
failure = 1;
|
||||
}
|
||||
@@ -187,7 +192,7 @@ void fiber_sender(void)
|
||||
&loopback_addr, 4242,
|
||||
&any_addr, 0);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("Cannot get network context");
|
||||
PRINT("Cannot get network context\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,12 +205,12 @@ void fiber_sender(void)
|
||||
data_len = sent_len - header_size;
|
||||
ip_buf_appdatalen(buf) = data_len;
|
||||
|
||||
SYS_LOG_INF("[%d] %s: App data: %d bytes, IPv6+UDP:"
|
||||
" %d bytes, Total packet size: %d bytes",
|
||||
sent, __func__, len, header_size, sent_len);
|
||||
PRINT("[%d] %s: App data: %d bytes, IPv6+UDP: %d bytes, "
|
||||
"Total packet size: %d bytes\n",
|
||||
sent, __func__, len, header_size, sent_len);
|
||||
|
||||
if (net_send(buf) < 0) {
|
||||
SYS_LOG_INF("[%d] %s: net_send failed!",
|
||||
PRINT("[%d] %s: net_send failed!\n",
|
||||
sent, __func__);
|
||||
failure = 1;
|
||||
}
|
||||
@@ -224,9 +229,9 @@ void fiber_sender(void)
|
||||
}
|
||||
|
||||
if (failure) {
|
||||
SYS_LOG_INF("TEST FAILED");
|
||||
PRINT("TEST FAILED\n");
|
||||
} else {
|
||||
SYS_LOG_INF("TEST PASSED");
|
||||
PRINT("TEST PASSED\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +240,7 @@ void main(void)
|
||||
struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; /* :: */
|
||||
struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; /* ::1 */
|
||||
|
||||
SYS_LOG_INF("%s: running network loopback test", __func__);
|
||||
PRINT("%s: running network loopback test\n", __func__);
|
||||
|
||||
sys_rand32_init();
|
||||
|
||||
|
||||
34
samples/net/nats_clients/KNOWN_ISSUES
Normal file
34
samples/net/nats_clients/KNOWN_ISSUES
Normal file
@@ -0,0 +1,34 @@
|
||||
Issues
|
||||
------
|
||||
|
||||
- Unable to connect
|
||||
Caused by:
|
||||
Incorrect TCP flags handling from the Zephyr IP Stack.
|
||||
Workaround:
|
||||
Reset the board.
|
||||
|
||||
- Publisher or Subscriber error
|
||||
Caused by:
|
||||
The NATS server will send the PING message at configurable
|
||||
intervals. If the PING message is not handled by the
|
||||
client, the server will close the connection.
|
||||
|
||||
The NATS applications are synchronous, so if the PING
|
||||
message arrives when the application is processing
|
||||
another message (i.e. verbose = 1), the PING message
|
||||
will be ignored and the server will close the connection.
|
||||
Workaround:
|
||||
Codify a routine similar to handle_msg (see main.c) to
|
||||
handle all the incoming messages.
|
||||
|
||||
- RX or TX error
|
||||
Caused by:
|
||||
Perhaps the rx/tx timeouts are too short for the LAN.
|
||||
Workaround:
|
||||
Increase the rx or tx timeout.
|
||||
See: publisher/src/netz.c, struct netz_ctx_t.
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
See the ./README file.
|
||||
@@ -1,4 +1,3 @@
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NETWORKING_WITH_LOGGING=y
|
||||
CONFIG_NETWORKING_WITH_6LOWPAN=y
|
||||
|
||||
@@ -18,8 +18,13 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_SANITY_TEST
|
||||
#include <tc_util.h>
|
||||
@@ -94,7 +99,7 @@ static const char *lorem_ipsum =
|
||||
|
||||
static inline void init_test()
|
||||
{
|
||||
SYS_LOG_INF("%s: run 802.15.4 loopback tester", __func__);
|
||||
PRINT("%s: run 802.15.4 loopback tester\n", __func__);
|
||||
|
||||
net_set_mac(src_mac, sizeof(src_mac));
|
||||
|
||||
@@ -112,11 +117,11 @@ static void set_routes()
|
||||
*/
|
||||
if (!uip_ds6_nbr_add((uip_ipaddr_t *)&in6addr_dest,
|
||||
&dest_mac, 0, NBR_REACHABLE))
|
||||
SYS_LOG_INF("Cannot add neighbor cache");
|
||||
PRINT("Cannot add neighbor cache\n");
|
||||
|
||||
if (!uip_ds6_route_add((uip_ipaddr_t *)&in6addr_dest, 128,
|
||||
(uip_ipaddr_t *)&in6addr_dest))
|
||||
SYS_LOG_INF("Cannot add localhost route");
|
||||
PRINT("Cannot add localhost route\n");
|
||||
}
|
||||
|
||||
static void send_data(const char *taskname, struct net_context *ctx)
|
||||
@@ -137,11 +142,11 @@ static void send_data(const char *taskname, struct net_context *ctx)
|
||||
sent_len = buf->len;
|
||||
|
||||
if (net_send(buf) < 0) {
|
||||
SYS_LOG_INF("%s: %s(): sending %d bytes failed",
|
||||
PRINT("%s: %s(): sending %d bytes failed\n",
|
||||
taskname, __func__, len);
|
||||
ip_buf_unref(buf);
|
||||
} else {
|
||||
SYS_LOG_INF("%s: %s(): sent %d bytes", taskname,
|
||||
PRINT("%s: %s(): sent %d bytes\n", taskname,
|
||||
__func__, sent_len);
|
||||
}
|
||||
}
|
||||
@@ -156,11 +161,11 @@ static void receive_data(const char *taskname, struct net_context *ctx)
|
||||
|
||||
buf = net_receive(ctx, TICKS_NONE);
|
||||
if (buf) {
|
||||
SYS_LOG_INF("%s: %s(): received %d bytes", taskname,
|
||||
PRINT("%s: %s(): received %d bytes\n", taskname,
|
||||
__func__, ip_buf_appdatalen(buf));
|
||||
if (memcmp(ip_buf_appdata(buf),
|
||||
lorem_ipsum, sizeof(lorem_ipsum))) {
|
||||
SYS_LOG_INF("ERROR: data does not match");
|
||||
PRINT("ERROR: data does not match\n");
|
||||
|
||||
#ifdef CONFIG_NET_SANITY_TEST
|
||||
rp = TC_FAIL;
|
||||
@@ -195,7 +200,7 @@ static struct net_context *get_context(const struct net_addr *remote,
|
||||
remote, remote_port,
|
||||
local, local_port);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -259,7 +264,7 @@ void taskA(void)
|
||||
|
||||
ctx = get_context(&any_addr, SRC_PORT, &loopback_addr, DEST_PORT);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -298,7 +303,7 @@ void taskB(void)
|
||||
|
||||
ctx = get_context(&loopback_addr, DEST_PORT, &any_addr, SRC_PORT);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -339,7 +344,7 @@ void fiber_receiving(void)
|
||||
|
||||
ctx = get_context(&any_addr, SRC_PORT, &loopback_addr, DEST_PORT);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("%s: Cannot get network context", __func__);
|
||||
PRINT("%s: Cannot get network context\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -369,7 +374,7 @@ void fiber_sending(void)
|
||||
|
||||
ctx = get_context(&loopback_addr, DEST_PORT, &any_addr, SRC_PORT);
|
||||
if (!ctx) {
|
||||
SYS_LOG_INF("Cannot get network context");
|
||||
PRINT("Cannot get network context\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -392,7 +397,7 @@ void fiber_sending(void)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
SYS_LOG_INF("%s: run test_15_4", __func__);
|
||||
PRINT("%s: run test_15_4\n", __func__);
|
||||
|
||||
net_init();
|
||||
init_test();
|
||||
|
||||
4
samples/net/test_15_4/testcase.ini
Normal file
4
samples/net/test_15_4/testcase.ini
Normal file
@@ -0,0 +1,4 @@
|
||||
[test]
|
||||
tags = net
|
||||
platform_whitelist = quark_se_devboard
|
||||
build_only = true
|
||||
@@ -2,4 +2,3 @@ CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_SYS_POWER_MANAGEMENT=y
|
||||
CONFIG_DEVICE_POWER_MANAGEMENT=y
|
||||
CONFIG_TICKLESS_IDLE=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -17,12 +17,17 @@
|
||||
#include <zephyr.h>
|
||||
#include <power.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
{
|
||||
SYS_LOG_INF("Power management template!");
|
||||
PRINT("Power management template!\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
CONFIG_I2C=y
|
||||
CONFIG_NANO_TIMEOUTS=y
|
||||
|
||||
@@ -19,14 +19,20 @@
|
||||
#include <sensor.h>
|
||||
#include <nanokernel.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
struct device *dev = device_get_binding("BME280");
|
||||
|
||||
SYS_LOG_INF("dev %p name %s", dev, dev->config->name);
|
||||
PRINT("dev %p name %s\n", dev, dev->config->name);
|
||||
|
||||
while (1) {
|
||||
struct sensor_value temp, press, humidity;
|
||||
@@ -36,10 +42,9 @@ void main(void)
|
||||
sensor_channel_get(dev, SENSOR_CHAN_PRESS, &press);
|
||||
sensor_channel_get(dev, SENSOR_CHAN_HUMIDITY, &humidity);
|
||||
|
||||
SYS_LOG_INF("temp: %d.%06d; press: %d.%06d; "
|
||||
"humidity: %d.%06d",
|
||||
temp.val1, temp.val2, press.val1, press.val2,
|
||||
humidity.val1, humidity.val2);
|
||||
PRINT("temp: %d.%06d; press: %d.%06d; humidity: %d.%06d\n",
|
||||
temp.val1, temp.val2, press.val1, press.val2,
|
||||
humidity.val1, humidity.val2);
|
||||
|
||||
task_sleep(sys_clock_ticks_per_sec/5);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
CONFIG_I2C=y
|
||||
CONFIG_GPIO=y
|
||||
|
||||
@@ -20,8 +20,13 @@
|
||||
#include <nanokernel.h>
|
||||
#include <misc/printk.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MCP9808_TRIGGER
|
||||
static void trigger_handler(struct device *dev, struct sensor_trigger *trig)
|
||||
@@ -31,7 +36,7 @@ static void trigger_handler(struct device *dev, struct sensor_trigger *trig)
|
||||
sensor_sample_fetch(dev);
|
||||
sensor_channel_get(dev, SENSOR_CHAN_TEMP, &temp);
|
||||
|
||||
SYS_LOG_INF("trigger fired, temp %d.%06d", temp.val1, temp.val2);
|
||||
PRINT("trigger fired, temp %d.%06d\n", temp.val1, temp.val2);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -40,12 +45,14 @@ void main(void)
|
||||
struct device *dev = device_get_binding("MCP9808");
|
||||
|
||||
if (dev == NULL) {
|
||||
SYS_LOG_ERR("device not found. aborting test.");
|
||||
printk("device not found. aborting test.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SYS_LOG_DBG("dev %p", dev);
|
||||
SYS_LOG_DBG("dev %p name %s", dev, dev->config->name);
|
||||
#ifdef DEBUG
|
||||
PRINT("dev %p\n", dev);
|
||||
PRINT("dev %p name %s\n", dev, dev->config->name);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MCP9808_TRIGGER
|
||||
struct sensor_value val;
|
||||
@@ -69,7 +76,7 @@ void main(void)
|
||||
sensor_sample_fetch(dev);
|
||||
sensor_channel_get(dev, SENSOR_CHAN_TEMP, &temp);
|
||||
|
||||
SYS_LOG_INF("temp: %d.%06d", temp.val1, temp.val2);
|
||||
PRINT("temp: %d.%06d\n", temp.val1, temp.val2);
|
||||
|
||||
task_sleep(sys_clock_ticks_per_sec);
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Microkernel version of hello world demo has two tasks that utilize
|
||||
@@ -47,8 +51,7 @@ void helloLoop(const char *taskname, ksem_t mySem, ksem_t otherSem)
|
||||
task_sem_take(mySem, TICKS_UNLIMITED);
|
||||
|
||||
/* say "hello" */
|
||||
SYS_LOG_INF("%s: Hello World from %s!",
|
||||
taskname, CONFIG_ARCH);
|
||||
PRINT("%s: Hello World from %s!\n", taskname, CONFIG_ARCH);
|
||||
|
||||
/* wait a while, then let other task have a turn */
|
||||
task_sleep(SLEEPTICKS);
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -18,8 +18,14 @@
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Nanokernel version of hello world demo has a task and a fiber that utilize
|
||||
@@ -53,7 +59,7 @@ void fiberEntry(void)
|
||||
nano_fiber_sem_take(&nanoSemFiber, TICKS_UNLIMITED);
|
||||
|
||||
/* say "hello" */
|
||||
SYS_LOG_INF("Hello World!");
|
||||
PRINT("%s: Hello World!\n", __func__);
|
||||
|
||||
/* wait a while, then let task have a turn */
|
||||
nano_fiber_timer_start(&timer, SLEEPTICKS);
|
||||
@@ -75,7 +81,7 @@ void main(void)
|
||||
|
||||
while (1) {
|
||||
/* say "hello" */
|
||||
SYS_LOG_INF("Hello World!");
|
||||
PRINT("%s: Hello World!\n", __func__);
|
||||
|
||||
/* wait a while, then let fiber have a turn */
|
||||
nano_task_timer_start(&timer, SLEEPTICKS);
|
||||
|
||||
@@ -10,4 +10,3 @@ CONFIG_SYS_LOG_USB_LEVEL=0
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_UART_LINE_CTRL=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
||||
@@ -28,9 +28,13 @@
|
||||
#include <uart.h>
|
||||
#include <zephyr.h>
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
static const char *banner1 = "Send characters to the UART device\r\n";
|
||||
static const char *banner2 = "Characters read:\r\n";
|
||||
@@ -86,35 +90,35 @@ void main(void)
|
||||
|
||||
dev = device_get_binding(CONFIG_CDC_ACM_PORT_NAME);
|
||||
if (!dev) {
|
||||
SYS_LOG_INF("CDC ACM device not found");
|
||||
PRINT("CDC ACM device not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SYS_LOG_INF("Wait for DTR");
|
||||
PRINT("Wait for DTR\n");
|
||||
while (1) {
|
||||
uart_line_ctrl_get(dev, LINE_CTRL_DTR, &dtr);
|
||||
if (dtr)
|
||||
break;
|
||||
}
|
||||
SYS_LOG_INF("DTR set, start test");
|
||||
PRINT("DTR set, start test\n");
|
||||
|
||||
/* They are optional, we use them to test the interrupt endpoint */
|
||||
ret = uart_line_ctrl_set(dev, LINE_CTRL_DCD, 1);
|
||||
if (ret)
|
||||
SYS_LOG_INF("Failed to set DCD, ret code %d", ret);
|
||||
PRINT("Failed to set DCD, ret code %d\n", ret);
|
||||
|
||||
ret = uart_line_ctrl_set(dev, LINE_CTRL_DSR, 1);
|
||||
if (ret)
|
||||
SYS_LOG_INF("Failed to set DSR, ret code %d", ret);
|
||||
PRINT("Failed to set DSR, ret code %d\n", ret);
|
||||
|
||||
/* Wait 1 sec for the host to do all settings */
|
||||
sys_thread_busy_wait(1000000);
|
||||
|
||||
ret = uart_line_ctrl_get(dev, LINE_CTRL_BAUD_RATE, &baudrate);
|
||||
if (ret)
|
||||
SYS_LOG_INF("Failed to get baudrate, ret code %d", ret);
|
||||
PRINT("Failed to get baudrate, ret code %d\n", ret);
|
||||
else
|
||||
SYS_LOG_INF("Baudrate detected: %d", baudrate);
|
||||
PRINT("Baudrate detected: %d\n", baudrate);
|
||||
|
||||
uart_irq_callback_set(dev, interrupt_handler);
|
||||
write_data(dev, banner1, strlen(banner1));
|
||||
|
||||
@@ -4,8 +4,6 @@ CONFIG_ARC_INIT=n
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_DW=y
|
||||
CONFIG_USB_DEVICE_STACK=y
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_SYS_LOG_USB_DFU_LEVEL=0
|
||||
CONFIG_SYS_LOG_USB_DW_LEVEL=0
|
||||
CONFIG_SYS_LOG_USB_LEVEL=0
|
||||
CONFIG_FLASH=y
|
||||
|
||||
@@ -27,8 +27,13 @@
|
||||
#include <zephyr.h>
|
||||
#include "usb_dfu.h"
|
||||
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SOC_QUARK_SE
|
||||
#define DFU_FLASH_DEVICE "QUARK_FLASH"
|
||||
@@ -44,11 +49,11 @@ void main(void)
|
||||
{
|
||||
struct device *dev = NULL;
|
||||
|
||||
SYS_LOG_INF("DFU Test Application");
|
||||
PRINT("DFU Test Application\n");
|
||||
|
||||
dev = device_get_binding(DFU_FLASH_DEVICE);
|
||||
if (!dev) {
|
||||
SYS_LOG_ERR("Flash device not found");
|
||||
printf("Flash device not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,16 @@
|
||||
#include "usb_dfu.h"
|
||||
|
||||
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_USB_DFU_LEVEL
|
||||
#include <misc/sys_log.h>
|
||||
#ifndef CONFIG_USB_DFU_DEBUG
|
||||
#define DBG(...) { ; }
|
||||
#else
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define DBG printf
|
||||
#else
|
||||
#define DBG printk
|
||||
#endif /* CONFIG_STDOUT_CONSOLE */
|
||||
#endif /* CONFIG_USB_DFU_DEBUG */
|
||||
|
||||
/* Alternate settings are used to access additional memory segments.
|
||||
* This example uses the alternate settings as an offset into flash.
|
||||
@@ -338,7 +346,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
|
||||
switch (pSetup->bRequest) {
|
||||
case DFU_GETSTATUS:
|
||||
SYS_LOG_DBG("DFU_GETSTATUS: status %d, state %d",
|
||||
DBG("DFU_GETSTATUS: status %d, state %d\n",
|
||||
dfu_data.status, dfu_data.state);
|
||||
|
||||
if (dfu_data.state == dfuMANIFEST_SYNC)
|
||||
@@ -354,13 +362,13 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
break;
|
||||
|
||||
case DFU_GETSTATE:
|
||||
SYS_LOG_DBG("DFU_GETSTATE");
|
||||
DBG("DFU_GETSTATE\n");
|
||||
(*data)[0] = dfu_data.state;
|
||||
*data_len = 1;
|
||||
break;
|
||||
|
||||
case DFU_ABORT:
|
||||
SYS_LOG_DBG("DFU_ABORT");
|
||||
DBG("DFU_ABORT\n");
|
||||
|
||||
if (dfu_check_app_state())
|
||||
return -EINVAL;
|
||||
@@ -371,7 +379,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
break;
|
||||
|
||||
case DFU_CLRSTATUS:
|
||||
SYS_LOG_DBG("DFU_CLRSTATUS");
|
||||
DBG("DFU_CLRSTATUS\n");
|
||||
|
||||
if (dfu_check_app_state())
|
||||
return -EINVAL;
|
||||
@@ -381,7 +389,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
break;
|
||||
|
||||
case DFU_DNLOAD:
|
||||
SYS_LOG_DBG("DFU_DNLOAD block %d, len %d, state %d",
|
||||
DBG("DFU_DNLOAD block %d, len %d, state %d\n",
|
||||
pSetup->wValue, pSetup->wLength, dfu_data.state);
|
||||
|
||||
if (dfu_check_app_state())
|
||||
@@ -390,7 +398,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
switch (dfu_data.state) {
|
||||
case dfuIDLE:
|
||||
dfu_reset_counters();
|
||||
SYS_LOG_DBG("DFU_DNLOAD start");
|
||||
DBG("DFU_DNLOAD start\n");
|
||||
case dfuDNLOAD_IDLE:
|
||||
if (pSetup->wLength != 0) {
|
||||
/* Download has started */
|
||||
@@ -402,13 +410,12 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
DFU_FLASH_ADDR +
|
||||
dfu_data.bytes_rcvd,
|
||||
dfu_data.flash_page_size);
|
||||
SYS_LOG_DBG("Flash erase");
|
||||
DBG("Flash erase\n");
|
||||
if (ret) {
|
||||
dfu_data.state = dfuERROR;
|
||||
dfu_data.status = errERASE;
|
||||
SYS_LOG_ERR("DFU flash erase "
|
||||
"error, ret %d",
|
||||
ret);
|
||||
DBG("DFU flash erase error, "
|
||||
"ret %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,8 +428,8 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
if (ret) {
|
||||
dfu_data.state = dfuERROR;
|
||||
dfu_data.status = errWRITE;
|
||||
SYS_LOG_ERR("DFU flash write error, "
|
||||
"ret %d", ret);
|
||||
DBG("DFU flash write error, ret %d\n",
|
||||
ret);
|
||||
} else
|
||||
dfu_data.bytes_rcvd += pSetup->wLength;
|
||||
} else {
|
||||
@@ -432,8 +439,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SYS_LOG_ERR("DFU_DNLOAD wrong state %d",
|
||||
dfu_data.state);
|
||||
DBG("DFU_DNLOAD wrong state %d\n", dfu_data.state);
|
||||
dfu_data.state = dfuERROR;
|
||||
dfu_data.status = errUNKNOWN;
|
||||
dfu_reset_counters();
|
||||
@@ -441,7 +447,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
}
|
||||
break;
|
||||
case DFU_UPLOAD:
|
||||
SYS_LOG_DBG("DFU_UPLOAD block %d, len %d, state %d",
|
||||
DBG("DFU_UPLOAD block %d, len %d, state %d\n",
|
||||
pSetup->wValue, pSetup->wLength, dfu_data.state);
|
||||
|
||||
if (dfu_check_app_state())
|
||||
@@ -450,12 +456,12 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
switch (dfu_data.state) {
|
||||
case dfuIDLE:
|
||||
dfu_reset_counters();
|
||||
SYS_LOG_DBG("DFU_UPLOAD start");
|
||||
DBG("DFU_UPLOAD start\n");
|
||||
case dfuUPLOAD_IDLE:
|
||||
if (!pSetup->wLength ||
|
||||
dfu_data.block_nr != pSetup->wValue) {
|
||||
SYS_LOG_ERR("DFU_UPLOAD block %d, expected "
|
||||
"%d, len %d", pSetup->wValue,
|
||||
DBG("DFU_UPLOAD block %d, expected %d, "
|
||||
"len %d\n", pSetup->wValue,
|
||||
dfu_data.block_nr, pSetup->wLength);
|
||||
dfu_data.state = dfuERROR;
|
||||
dfu_data.status = errUNKNOWN;
|
||||
@@ -498,8 +504,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
|
||||
break;
|
||||
default:
|
||||
SYS_LOG_ERR("DFU_UPLOAD wrong state %d",
|
||||
dfu_data.state);
|
||||
DBG("DFU_UPLOAD wrong state %d\n", dfu_data.state);
|
||||
dfu_data.state = dfuERROR;
|
||||
dfu_data.status = errUNKNOWN;
|
||||
dfu_reset_counters();
|
||||
@@ -507,7 +512,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
}
|
||||
break;
|
||||
case DFU_DETACH:
|
||||
SYS_LOG_DBG("DFU_DETACH timeout %d, state %d",
|
||||
DBG("DFU_DETACH timeout %d, state %d\n",
|
||||
pSetup->wValue, dfu_data.state);
|
||||
|
||||
if (dfu_data.state != appIDLE) {
|
||||
@@ -528,7 +533,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
||||
usb_set_config(&dfu_config);
|
||||
break;
|
||||
default:
|
||||
SYS_LOG_ERR("DFU UNKNOWN STATE: %d", pSetup->bRequest);
|
||||
DBG("DFU UNKNOWN STATE: %d\n", pSetup->bRequest);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -547,33 +552,32 @@ static void dfu_status_cb(enum usb_dc_status_code status)
|
||||
/* Check the USB status and do needed action if required */
|
||||
switch (status) {
|
||||
case USB_DC_ERROR:
|
||||
SYS_LOG_ERR("USB device error");
|
||||
DBG("USB device error\n");
|
||||
break;
|
||||
case USB_DC_RESET:
|
||||
SYS_LOG_DBG("USB device reset detected, state %d",
|
||||
dfu_data.state);
|
||||
DBG("USB device reset detected, state %d\n", dfu_data.state);
|
||||
if (dfu_data.state == appDETACH) {
|
||||
dfu_data.state = dfuIDLE;
|
||||
}
|
||||
break;
|
||||
case USB_DC_CONNECTED:
|
||||
SYS_LOG_DBG("USB device connected");
|
||||
DBG("USB device connected\n");
|
||||
break;
|
||||
case USB_DC_CONFIGURED:
|
||||
SYS_LOG_DBG("USB device configured");
|
||||
DBG("USB device configured\n");
|
||||
break;
|
||||
case USB_DC_DISCONNECTED:
|
||||
SYS_LOG_DBG("USB device disconnected");
|
||||
DBG("USB device disconnected\n");
|
||||
break;
|
||||
case USB_DC_SUSPEND:
|
||||
SYS_LOG_DBG("USB device supended");
|
||||
DBG("USB device supended\n");
|
||||
break;
|
||||
case USB_DC_RESUME:
|
||||
SYS_LOG_DBG("USB device resumed");
|
||||
DBG("USB device resumed\n");
|
||||
break;
|
||||
case USB_DC_UNKNOWN:
|
||||
default:
|
||||
SYS_LOG_WRN("USB unknown state");
|
||||
DBG("USB unknown state\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -596,12 +600,11 @@ static int dfu_custom_handle_req(struct usb_setup_packet *pSetup,
|
||||
if (REQTYPE_GET_RECIP(pSetup->bmRequestType) ==
|
||||
REQTYPE_RECIP_INTERFACE) {
|
||||
if (pSetup->bRequest == REQ_SET_INTERFACE) {
|
||||
SYS_LOG_DBG("DFU alternate setting %d",
|
||||
pSetup->wValue);
|
||||
DBG("DFU alternate setting %d\n", pSetup->wValue);
|
||||
|
||||
if (pSetup->wValue >= DFU_MODE_ALTERNATE_SETTINGS) {
|
||||
SYS_LOG_DBG("Invalid DFU alternate setting "
|
||||
"(%d)", pSetup->wValue);
|
||||
DBG("Invalid DFU alternate setting (%d)\n",
|
||||
pSetup->wValue);
|
||||
} else {
|
||||
dfu_data.alt_setting = pSetup->wValue;
|
||||
}
|
||||
@@ -652,14 +655,14 @@ int dfu_start(struct device *flash_dev, uint32_t flash_base_addr,
|
||||
/* Initialize the USB driver with the right configuration */
|
||||
ret = usb_set_config(&dfu_config);
|
||||
if (ret < 0) {
|
||||
SYS_LOG_ERR("Failed to config USB");
|
||||
DBG("Failed to config USB\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Enable USB driver */
|
||||
ret = usb_enable(&dfu_config);
|
||||
if (ret < 0) {
|
||||
SYS_LOG_ERR("Failed to enable USB");
|
||||
DBG("Failed to enable USB\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,4 +22,6 @@ TOOLCHAIN_LIBS = gcc
|
||||
|
||||
LIB_INCLUDE_DIR += -L ${XTOOLS_TOOLCHAIN_PATH}/${CROSS_COMPILE_TARGET}/lib/gcc/${CROSS_COMPILE_TARGET}/${CROSS_COMPILE_version}/
|
||||
|
||||
export CROSS_COMPILE TOOLCHAIN_LIBS LIB_INCLUDE_DIR TOOLCHAIN_CFLAGS
|
||||
QEMU_BIN_PATH ?= /usr/local/bin
|
||||
|
||||
export CROSS_COMPILE TOOLCHAIN_LIBS LIB_INCLUDE_DIR TOOLCHAIN_CFLAGS QEMU_BIN_PATH
|
||||
|
||||
@@ -11,7 +11,7 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
prepare() {
|
||||
if [[ ! -d ./src ]]; then
|
||||
git clone git://git.savannah.gnu.org/grub.git src
|
||||
git clone http://git.savannah.gnu.org/r/grub.git src
|
||||
fi
|
||||
|
||||
pushd src
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user