Commit graph

374 commits

Author SHA1 Message Date
Andrei Emeltchenko 3b1775d0cc drivers: console: Add DTS defaults
Add default which takes the target device from DTS similar way to UART
console.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko 8d69832bfd console: ipm_console: Add console over IPM
Add console over Inter Processor Mailboxes (IPM).
This is useful for AMP processors like ADSP found on up_squared board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Peter A. Bigot 0839f38451 drivers: console: fix Kconfig DTS inference for mcumgr uart
The conversion last year mixed up uart-pipe with uart-mcumgr.  Revert
to the pre-conversion relationship.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-09-02 14:56:19 -05:00
Tomasz Bursztyka d1c68de67e drivers: console: Fix device instance const qualifier loss in IPM driver
Passing the device's data and config is sufficient for the thread.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Marcin Niestroj 1e6679a23b drivers: console: uart_mux: consume ringbuf until it is empty
ringbuf claim API returns pointer to contiguous area. In cases when data
in ringbuf wraps the end of internal buffer, then single call to claim
data is not enough to get all data - there is remaining part on the
beginning of internal buffer. Those remaining bytes will need to wait
for next ISR handler to trigger workqueue. Theoretically this means that
data on the beginning of ringbuf can wait there forever.

Consume data from ringbuf in a loop, stopping only when claiming results
in empty buffer. This will make sure that there is no stale data in the
ringbuf.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-21 13:51:45 -04:00
Emil Obalski 80a89ef799 console: usb: Remove obsolete Kconfig option.
This patch removes unused Kconfig option from console
subsystem. If application wants to wait until the console
port is connected, enabled and ready to receive data
it should use uart_line_ctrl_get() API function and
check for DTR flag.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:49:47 +02:00
Emil Obalski b552e60765 samples: usb: Make USB console samples call usb_enable()
usb_enable() must be called once by the application.
The application may want to register usb_dc_status_callback
and trace usb status codes (usb_dc_status_code).

After this patch all pre APPLICATION messages will be dropped
as USB console device is enabled in the application.

Application waits for console device until its ready by checking DTR
flag - uart_line_ctrl_get(). This function could be dropped but then
some log messages that were generated before USB device is ready
could also be dropped.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:49:47 +02:00
Tomasz Bursztyka 98d9b01322 device: Apply driver_api/data attributes rename everywhere
Via coccinelle:

@r_device_driver_api_and_data_1@
struct device *D;
@@
(
D->
-	driver_api
+	api
|
D->
-	driver_data
+	data
)

@r_device_driver_api_and_data_2@
expression E;
@@
(
net_if_get_device(E)->
-	driver_api
+	api
|
net_if_get_device(E)->
-	driver_data
+	data
)

And grep/sed rules for macros:

git grep -rlz 'dev)->driver_data' |
	xargs -0 sed -i 's/dev)->driver_data/dev)->data/g'

git grep -rlz 'dev->driver_data' |
	xargs -0 sed -i 's/dev->driver_data/dev->data/g'

git grep -rlz 'device->driver_data' |
	xargs -0 sed -i 's/device->driver_data/device->data/g'

Fixes #27397

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-08-11 19:30:53 +02:00
Tomasz Bursztyka af6140cc0d device: Apply config_info rename everywhere
Via coccinelle:

@r_device_config@
struct device *D;
@@

D->
-	config_info
+	config

And 2 grep/sed rules for macros:

git grep -rlz 'dev)->config_info' |
	xargs -0 sed -i 's/dev)->config_info/dev)->config/g'

git grep -rlz 'dev->config_info' |
	xargs -0 sed -i 's/dev->config_info/dev->config/g'

Fixes #27397

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-08-11 19:30:53 +02:00
Andrew Boie 7d920ba39b drivers: use K_KERNEL_STACK macros
None of these threads run in user mode and we can save some
memory.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-04 12:16:43 -04:00
Carles Cufi 244f826e3c cmake: remove _if_kconfig() functions
This set of functions seem to be there just because of historical
reasons, stemming from Kbuild. They are non-obvious and prone to errors,
so remove them in favor of the `_ifdef()` ones with an explicit
`CONFIG_` condition.

Script used:

git grep -l _if_kconfig | xargs sed -E -i
"s/_if_kconfig\(\s*(\w*)/_ifdef(CONFIG_\U\1\E \1/g"

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-08-01 12:35:20 +02:00
Carles Cufi c200b1c5e6 mgmt: Move mcumgr into its own folder
In order to be able to add more entries under 'subsys/mgmt', move the
current contents of it, which relate exclusively to MCUMgr, to its own
folder.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-07-31 08:46:53 -05:00
Tomasz Bursztyka c6706561b9 drivers: Apply IPM callback signature change where relevant
Of course IPM drivers now provide their device instance. There are 2
drivers using IPM callbacks as well, so they get the imp device instance
pointer now through the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:51:51 +02:00
Tomasz Bursztyka 7d1af02410 uart: Fix uart_irq_callback_set usage
It was already using uart_irq_callback_user_data_set below, now it also
uses uart_irq_callback_user_data_t as callback type, so let's normalize
the callbacks.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Tomasz Bursztyka 701869fc48 uart: Fix uart_irq_callback_user_data_set usage
Now providing the struct device * to the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Marcin Niestroj 68d0042138 drivers: console: gsm_mux: fix timeout after timeout API change
New timeout API uses opaque k_timeout_t type. Adjust code to work with
that properly.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-07 15:08:43 +02:00
Flavio Ceolin b0d1abac9c drivers: uart_mux: Add missing verfification handler
Add the verifcation handler for the syscall uart_mux_find.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-13 16:37:58 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Johann Fischer 6da7e41592 drivers: console: fix USB initialization
Initialize USB even if USB_UART_DTR_WAIT is not enabled.

Fixes: #25811

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-06-02 18:02:16 +02:00
Erwan Gouriou 2716cbcaa6 drivers: susbsys: Check errors on devices selected using dt macro
Some Kconfig defined devices may be defined using dt_chosen_label
function. Since there is no way to ensure a device enabled in dts
is also defined in Kconfig, it may happen that instance is not
actually defined.
In this case device_get_binding might return 0, leading to undefined
behavior in the function that calls it.
When not already done, systematically check return of function
device_get_binding on devices defined through dt_chosen_label macro.
Trigger ASSERT when required and return error when possible.

Fixes #20068

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-25 11:43:14 +02:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
ZhongYao Luo 1811fff2dd console: Add semihosting console
Many chips have only one serial port. When the serial port is occupied
by other devices, there is a lack of a console to output debugging
information. Semihosting can provide a console. The disadvantage of
semihosting is that a debugger must be connected, so it can only be
used for online debugging.

Signed-off-by: ZhongYao Luo <LuoZhongYao@gmail.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 23:33:38 -05:00
Jukka Rissanen d75c83cdbe drivers: gsm_mux: Convert to use k_timeout_t
Convert to use k_timeout_t

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 31ec75fca3 modem: shell: Add info command
Add an information command that currently will only prints
GSM muxing status.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen be81b804f6 drivers: console: uart_mux: Use own workqueue
Instead of global workqueue, use own one so that the users of this
driver can more conveniently use global one. This means GSM modem
can work better with the UART muxing driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 492088b3fa net: ppp: Convert PPP driver to use normal UART APIs
This is needed so that we can support GSM 07.10 muxing protocol.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 420b195b5e drivers: console: uart_mux: Initial UART muxing support
Create support for muxed UARTs which are attached to a real
UART and which use GSM 07.10 muxing protocol to create virtual
channels that can be run on top of the real UART.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen b5525a0f91 drivers: gsm_mux: Support GSM 07.10 muxing protocol
Add support to GSM 07.10 muxing protocol which is used to
share the same UART for PPP and AT commands among other things.
This allows e.g., the modem to send SMS and have PPP connection
active at the same time.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Andy Ross 32bb2395c2 timeout: Fix up API usage
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04:00
Tomasz Bursztyka 8da8b5c933 drivers/console: Removing left-over cmake directive about telnet
Telnet console was move as a shell backend and is not anymore part of
console drivers.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-16 11:29:54 -04:00
Andrei Emeltchenko f57f7d162c console: xtensa_sim_console: Cleanup and use static keyword
Cleanup xtensa_sim_console and use static keyword.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-03-11 09:17:38 -04:00
Andrei Emeltchenko caa95fc10d console: uart_console: Use static for static functions
Use static keyword for static functions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-03-11 09:17:38 -04:00
Flavio Ceolin d507574864 console: uart: Ifdef an include
usb-device.h must be included only if CONFIG_USB_UART_CONSOLE is
defined, otherwise it is not used and will pull a lot of usb code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-01-28 14:02:54 -05:00
Peter Bigot 6a964663b1 treewide: use full path to console/uart_pipe.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Peter Bigot f780247d8a treewide: use full path to console/uart_mcumgr.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Peter Bigot 47e62276ff treewide: use full path to console/ipm_console.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Ulf Magnusson 72a350c3dc console: kconfig: Have CONSOLE_HANDLER dep. on SERIAL_SUPPORT_INTERRUPT
CONSOLE_HANDLER was unconditionally selecting UART_INTERRUPT_DRIVEN (and
depends on it in the code), but UART_INTERRUPT_DRIVEN depends on
SERIAL && SERIAL_SUPPORT_INTERRUPT.

Add a SERIAL_SUPPORT_INTERRUPT dependency to CONSOLE_HANDLER.
CONSOLE_HANDLER already depends on UART_CONSOLE, which depends on
SERIAL, so a SERIAL dependency does not need to be added.

This avoids some selects with unsatisfied dependencies in CI.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-24 22:48:40 +01:00
Emil Obalski 2128750138 usb: api: Add user device status callback
By this commit user gets possibility to register USB
device satutus callback. This callback represents device state
and is added so user could know what happend to USB device.

Callback is registered by providing it to usb_enable()
USB api is extended by this callback handler.

Samples using using USB are by default provide no callback
and the usb_enable() is called with NULL parameter.

Status callback registered by hid class is deleted as now
USB device has global callback for all classes within device.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-19 13:08:55 +01:00
Emil Obalski d65027d8c0 usb: samples: Application calling usb_enable by itself
User app is reponsible for issuing usb_enable and
making USB hardware operative.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-19 13:08:55 +01:00
Ulf Magnusson 984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Peter A. Bigot a58d8ebaa6 driver: uart: make deprecation effective
Several macros were documented as deprecated but lacked the
infrastructure to produce deprecation warnings.  Add the deprecation
marker, and fix the in-tree references to the deprecated spellings.

Note that one non-deprecated macro should have been deprecated, and
is, referring to a newly added line control bit.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-07 12:44:15 -06:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ulf Magnusson 975de21858 kconfig: Global whitespace/consistency cleanup
Clean up space errors and use a consistent style throughout the Kconfig
files. This makes reading the Kconfig files more distraction-free, helps
with grepping, and encourages the same style getting copied around
everywhere (meaning another pass hopefully won't be needed).

Go for the most common style:

 - Indent properties with a single tab, including for choices.

   Properties on choices work exactly the same syntactically as
   properties on symbols, so not sure how the no-indentation thing
   happened.

 - Indent help texts with a tab followed by two spaces

 - Put a space between 'config' and the symbol name, not a tab. This
   also helps when grepping for definitions.

 - Do '# A comment' instead of '#A comment'

I tweaked Kconfiglib a bit to find most of the stuff.

Some help texts were reflowed to 79 columns with 'gq' in Vim as well,
though not all, because I was afraid I'd accidentally mess up
formatting.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-01 15:53:23 +01:00
Ulf Magnusson b222cf67f1 drivers: console: kconfig: Remove unused NATIVE_STDIN_PRIO symbol
Unused since commit 140a8d0c8a ("console: Remove deprecated function
console_register_line_input").

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-21 08:16:42 -05:00
Ulf Magnusson 7e8cb3c591 drivers: console: kconfig: Remove unused IPM_CONSOLE_INIT_PRIORITY sym
Unused after commit 578ae40761 ("boards: remove quarl_se_c1000").

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-20 08:43:59 -05:00
Peter Bigot d566254e3f drivers: fix k_thread_create timeout argument
Use the named representation for no-wait to future-proof against a
change to the representation of timeout values.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-09-19 17:35:53 +02:00
Kumar Gala 140a8d0c8a console: Remove deprecated function console_register_line_input
console_register_line_input has been deprecated for at least 2 releases
so we can now remove it.  Remove native_stdin_register_input that is
associated with console_register_line_input.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-18 19:14:25 -05:00
Kumar Gala 8ce0cf0126 kconfig: Convert device tree chosen properties to new kconfigfunctions
Convert how we get the various chosen properties like "zephyr,console"
to use the new kconfig functions like dt_chosen_to_label.

Because of how kconfig parses things we define a set of variables of the
form DT_CHOSEN_Z_<PROP> since comma's are parsed as field seperators in
macros.

This conversion allows us to remove code in gen_defines.py for the
following chosen properties:

zephyr,console
zephyr,shell-uart
zephyr,bt-uart
zephyr,uart-pipe
zephyr,bt-mon-uart
zephyr,uart-mcumgr
zephyr,bt-c2h-uart

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-13 11:42:34 -05:00
Andrew Boie 3338c2878c drivers: ipm_console: increase coverage stack size
Code coverage requires significantly more stack space.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-04 07:25:44 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 5eb90ec169 cleanup: include/: move misc/__assert.h to sys/__assert.h
move misc/__assert.h to sys/__assert.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 7435e5e089 cleanup: include/: move ring_buffer.h to sys/ring_buffer.h
move ring_buffer.h to sys/ring_buffer.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif d1b2718687 cleanup: include/: move uart.h to drivers/uart.h
move uart.h to drivers/uart.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 6524925753 cleanup: include/: move ipm.h to drivers/ipm.h
move ipm.h to drivers/ipm.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif e1e05a2eac cleanup: include/: move atomic.h to sys/atomic.h
move atomic.h to sys/atomic.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 1034c5e398 drivers: uart_console: removed commented code
Remove all commented and unused code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 15:27:00 -04:00
Anas Nashif 7635cf80ab drivers: uart_console: do not include arch/cpu.h directly
No need tp include arch/cpu.h directly here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 15:27:00 -04:00
Anas Nashif e8a182ce26 drivers: uart_console: include correct path
include console.h from include/drivers/console

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 15:27:00 -04:00
Andrei Emeltchenko df2bb46497 usb: console: Initialize USB console after USB Device stack
It does make sense to initialize USB console after USB Device stack.
Note that the value is selected only if we specify USB_UART_CONSOLE
in prj.conf, not in menuconfig afterwards.

Fixes #16518

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-06-05 11:44:17 +02:00
Jukka Rissanen a9c99a60f0 drivers: console: Add support for log level option
Allow user to set log level for UART console drivers. Add
log level option to UART pipe driver in order to see what it
is sending and receiving.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-30 17:17:51 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Robert Lubos 77546a0e5a drivers: console: Remove TELNET driver
telnet_console is based on deprecated line_fifo module, and is no longer
used in Zephyr.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-04-01 10:26:13 -04:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Tomasz Bursztyka 03bfc5dd0f net/context: Remove token parameter from net_context_send/sendto
And also to the relevant callbacks.

That parameter is not used anywhere so it is useless.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka a25f054cbd net/pkt: Remove _new suffix to net_pkt_read functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka f8a091104e net/pkt: Remove _new suffix to net_pkt_get_data_new function
Now that legacy - and unrelated - function named net_pkt_get_data has
been removed, we can rename net_pkt_get_data_new relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 172fe5a87b net/context: Remove _new suffix on net_context_send/sendto functions
Now that legacy functions are removew, let's rename the new functions by
removing the _new suffix.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Ulf Magnusson 5cd92276e7 drivers: console: kconfig: Remove redundant 'depends on UART_MCUMGR'
Appears within an 'if UART_MCUMGR'.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-15 07:25:10 -05:00
Paul Sokolovsky 9ec9c430b3 console: tty: Remove dependency on older "consoles"
Console subsystem doesn't depend on older consoles-in-drivers, the
only common thing between them is CONFIG_UART_CONSOLE_ON_DEV_NAME
setting, so make it so (by depending on either UART_CONSOLE or
CONSOLE_SUBSYS.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-28 16:57:50 -08:00
Tomasz Bursztyka 5dc84fa6ed drivers/console: Switch telnet console driver to new net_pkt API
This simplifies a bit the driver itself as it does not need to create
the net_pkt it wants to send anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-19 11:29:07 -05:00
Kumar Gala ff70b3444f dts: Convert CONFIG_ to DT_ symbols for chosen props
Replace generating CONFIG_ symbols with DT_ symbols for chosen
properties like 'zephyr,console' or 'zephyr,bt-mon-uart'.  We now use a
kconfigfunctions (dt_str_val) to extract the info from dts into Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-08 11:41:26 -06:00
Tomasz Bursztyka 4b78a251d7 net/context: Make recv_cb providing the ip and protocol headers
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).

Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-01 14:34:38 +02:00
Jukka Rissanen 1cba0161ed net: websocket: Remove the websocket as HTTP APIs are removed
Remove the experimental websocket code as it uses HTTP APIs
which are being removed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-01-25 11:21:20 -05:00
Alberto Escolar Piedras acefd36501 native_posix: Remove all references to the defunct legacy shell
Remove all references in the documentation and Kconfig options
to the legacy shell to avoid confusing users and developers

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-18 18:25:05 -05:00
Aurelien Jarno 0ac7338258 drivers: console: fix USB_UART_CONSOLE
The USB_UART_CONSOLE option itself is not enough to enable console on
the USB UART port. Most of the code is actually shared with
UART_CONSOLE, so this symbol has to be selected.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2018-12-05 08:53:15 -05:00
Pawel Dunaj e344e5752c ext: debug: segger: Fix SEGGER header inclusion
Fix issue caused by 3fc497ac9a

This change removes `rtt` and `systemview` from header includes
as these are already placed in the path.

Also `SEGGER_SYSVIEW_ConfDefaults.h` header included from
`SEGGER_SYSVIEW_Int.h` is placed higher to make sure `INLINE`
definition is properly visible.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2018-12-05 14:35:42 +01:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Kumar Gala aa2bdbe322 drivers: Remove board.h include
We either don't need board.h in the driver or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:21:11 -04:00
Pavel Kral a19726ee1e logger: console: init rtt only once
As RTT is used by more subsystem in Zephyr, initialization is moved
from RTT console and RTT logger backend to common kernel init phase.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2018-10-31 12:47:53 +01:00
Pavel Kral 1a583fa8be ext: debug: segger: Add USE_SEGGER_RTT that enables RTT libraries.
This option allows to explicitly include Segger RTT libraries and
enables use of it for various subsystems. It is disabled by
default as it consumes more RAM.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2018-10-31 12:47:53 +01:00
Pavel Kral 2c84fd2631 ext: debug: segger: Terminal sharing using SEGGER_RTT_LOCK/UNLOCK macros
This commit allows to share default RTT (terminal) buffer with various
Zephyr subsystems.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2018-10-31 12:47:53 +01:00
Krzysztof Chruscinski ff5f00f2c3 lib: ring_buffer: Rename sys_ring_buf_ to ring_buf_item_
Deprecate API prefixed with sys_ring_buf_ and rename it
to ring_buf_item_ since this API is not a typical ring buffer
but ring buffer of data items (metadata + 32bit words).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-09 13:58:44 -04:00
Anas Nashif 5aef010a49 websocket_console: fix syntax
Fix layout and syntax with uncrustify after changing to new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif 6ac79df1e1 telnet_console: fix syntax
Fix layout and syntax with uncrustify after changing to new logger.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Anas Nashif a70e28e9e2 console: move to new logger
Use new logger and remove usage of SYS_LOG.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Alberto Escolar Piedras 013f279111 uart: Add driver for posix arch
Added a new UART driver for posix arch boards.
The driver can be configured to either attach to a new
pseudo-terminal, or to connect to the invoking shell
stdin-out.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-09-27 17:24:34 +02:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin 0866d18d03 irq: Fix irq_lock api usage
irq_lock returns an unsigned int, though, several places was using
signed int. This commit fix this behaviour.

In order to avoid this error happens again, a coccinelle script was
added and can be used to check violations.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-16 19:47:41 -07:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Alberto Escolar Piedras 00b07615fa native_posix: Add missing headers and function prototypes
A few function prototypes were missing in the native_posix
board and its drivers.
Let's add them.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-02 19:14:19 +02:00
Alberto Escolar Piedras 45b1079b6c drivers: console: Kconfig: Improve native descriptions
Improve the prompts and help messages for the NATIVE options
to make them less ambigous

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-01 09:51:41 -04:00
Ulf Magnusson 0aedf8d2c5 drivers: console: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-08 22:12:54 -04:00
Krzysztof Chruściński 5a1313f804 drivers: console: rtt: RTT session awareness
In order to avoid bytes dropping when RTT output buffer is full,
RTT session detection algorithm is introduced to the RTT console.
If host session is detected console retries after wait state
expecting host to empty the buffer. If host session is not detected
console drops the byte without retrying.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2018-06-28 09:36:58 -05:00
qianfan Zhao 13e1c3c2f8 uart_console: delete char using BS(08H) or DEL(7FH)
Some serial tools such as 'minicom' send BS when press backspace,
not DEL, so delete char using BS or DEL.

Fixes: #7959

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-05-29 16:21:55 -04:00
Michael Hope 8f7e5bd0a5 uart_pipe: re-work the RX function to match the API and work with USB.
include/uart.h says that an interrupt may be an edge or a level.
Re-work the uart_pipe interrupt handler to support both.  This makes
uart_pipe work with the USB CDC ACM driver.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-04-21 08:37:54 -07:00
Jukka Rissanen ead9cd409c net: websocket: Add console support
Add console driver that allows console session to be transferred
over a websocket connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-03-15 15:17:36 +02:00
Ruslan Mstoi ca94b86b3d drivers: console: Fix crash in shell
Shell crashes when enter is pressed. This commit reverts relevant
changes from 14735116d1 that cause
this issue.

Fixes #6322

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-02-22 15:29:08 -05:00
Christopher Collins 14735116d1 subsys: mgmt: UART transport for SMP (mcumgr).
Add a UART driver dedicated to transporting mcumgr SMP requests and
responses.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-02-20 22:07:52 +01:00
Anas Nashif 8949233390 kconfig: fix more help spacing issues
Fix Kconfig help sections and add spacing to be consistent across all
Kconfig file. In a previous run we missed a few.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-15 23:20:55 -05:00
David B. Kinder c2bf3af1de doc: fix misspellings in Kconfig files
Missed some misspellings during regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-02-07 14:51:46 -05:00
Ding Tao 6c00545d66 native: console: Fix Kconfig "multiple prompts" warnings
NATIVE_POSIX_STDIN_CONSOLE and NATIVE_POSIX_STDOUT_CONSOLE have more
than one prompts, this will cause warnings when run kconfig checks.

Remove one of two prompts.

Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-02-07 08:35:29 -05:00
Alberto Escolar Piedras e3f727cc6e native: added stdin handling for shell
Now the native console driver also handles stdin
so we can drive the shell from the command line,
a pipe or a file

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-02 07:48:46 -08:00
Paul Sokolovsky e25df54eae various: Update/fix some textual material and code comments.
Of these, only struct net_ipv6_nbr_data::send_ns is a descriptive
change:

send_ns is used for timing Neighbor Solicitations in general, not
just for DAD.

The rest are typo/grammar fixes.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-12-29 09:45:39 -05:00
Anas Nashif 6b55598ad4 board: posix: add native_posix board definition
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Anas Nashif e2122cbf89 lib: move ring_buffer from misc/ to lib/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-15 20:02:01 -05:00
Anas Nashif 429c2a4d9d kconfig: fix help syntax and add spaces
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-13 17:43:28 -06:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Jukka Rissanen 55b8edc88e net: Fix LLVM compiler warnings
Jira: ZEP-2488
Jira: ZEP-2486
Jira: ZEP-2485
Jira: ZEP-2482
Jira: ZEP-2480

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-09 12:50:50 -04:00
Anas Nashif 09bcd8ee74 Kconfig: make all syslog variables depend on SYS_LOG
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-04 14:34:54 -05:00
Savinay Dharmappa c1e5cbfd41 devicetree: Generate BLUETOOTH_UART,UART_PIPE etc config from dt
patch uses chosen property zephyr,bt-uart, zephyr,uart-pipe
and zephyr,bt-mon-uart to determine the uart instance to be
used for bluetooth,uart_pipe and bluetooth_monitor and generate
appropriate configs.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-07-19 11:52:35 -04:00
Kumar Gala 65e72be8f7 devicetree: Generate CONFIG_UART_CONSOLE_ON_DEV_NAME from dt
We can use the chosen property "zephyr,console" to determine what uart
should be used as the console and find its name to generate a define for
CONFIG_UART_CONSOLE_ON_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-11 12:09:10 -05:00
Geoff Gustafson 1405627c37 net: context: Use K_NO_WAIT instead of 0 for timeout
Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
2017-07-10 10:59:28 +03:00
Anas Nashif 397d29db42 linker: move all linker headers to include/linker
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-18 09:24:04 -05:00
Andrew Boie 2d4a36fc1c drivers: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie 0d7962cee3 drivers: telnet_console: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie b52a62b561 ipm_console_receiver: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Paul Sokolovsky 25307d5331 net: net_pkt_append: Refactor to return length of data actually added
For stream-based protocols (TCP), adding less data than requested
("short write") is generally not a problem - the rest of data can
be sent in the next packet. So, make net_pkt_append() return length
of written data instead of just bool flag, which makes it closer
to the behavior of POSIX send()/write() calls.

There're many users of older net_pkt_append() in the codebase
however, so net_pkt_append_all() convenience function is added which
keeps returning a boolean flag. All current users were converted to
this function, except for two:

samples/net/http_server/src/ssl_utils.c
samples/net/mbedtls_sslclient/src/tcp.c

Both are related to TLS and implement mbedTLS "tx callback", which
follows POSIX short-write semantics. Both cases also had a code to
workaround previous boolean-only behavior of net_pkt_append() - after
calling it, they measured length of the actual data added (but only
in case of successful return of net_pkt_append(), so that didn't
really help). So, these 2 cases are already improved.

Jira: ZEP-1984

Change-Id: Ibaf7c029b15e91b516d73dab3612eed190ee982b
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:09 +03:00
Adithya Baglody 23d946f4c0 drivers: console: Do not wait on the DTR signal from the host USB controller.
Jira: ZEP-1993
Change-Id: I4834d630f245f81381887af56e2d6ccd811094b4
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-04-25 02:33:01 +00:00
David B. Kinder 93e4d7258d spell: fix Kconfig help typos: /boards /drivers
Fix misspellings in Kconfig help text

Change-Id: I3ae28a5d23d8e266612114bc0eb8a6e158129dc7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-21 21:31:30 +00:00
Kumar Gala ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Tomasz Bursztyka db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
David B. Kinder 896cf7a00a spell: fix doxygen comment typos: /drivers
Fix doxygen comment typos used to generate API docs

Change-Id: I6fd5051c99bdcc731740c92001e525349c254d85
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-19 10:45:34 -07:00
Max Filippov 0ad868a58c xtensa_sim_console: fix simcall
simcall must be in the volatile asm so that gcc does not optimize it
out. It also needs "memory" clobber to make sure data passed through
memory buffer is actually written back before the simcall.

Change-Id: I410b7348bf605d0d08f81ec5395f6cb144f33a43
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2017-04-13 20:33:27 +00:00
Andrew Boie 3cc4d41438 ipm_console: add Kconfig for receiver stack size
Change-Id: I27c1189e3bf87b4ea3dc06d38f63cab21663697b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-03-06 16:58:20 +00:00
Andrew Boie 42562b9367 xtensa: fix numerous checkpatch issues
Change-Id: I903f5f0692849fb9e7bf5d978b63b12bf1bd6e33
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:03 -08:00
Andrew Boie eab8a9f9ca xtensa_sim_console: remove deprecation warning
Change-Id: I10181f6c4d90e38927c1831c93fc459d33de6fd1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER b0669a04b3 Xtensa port: Added support for Xtensa simulator console driver.
Change-Id: I58effa98fd6ff53bcfd21cb8de2fcd89651dc1d9
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Jukka Rissanen bd3908b2a9 net: nbuf: Add timeout to net_buf getters
This commit changes the net_buf getter functions in nbuf.h
by adding a timeout parameter. These function prototypes
are changed to accept a timeout parameter.
	net_nbuf_get_rx()
	net_nbuf_get_tx()
	net_nbuf_get_data()
	net_nbuf_get_reserve_rx()
	net_nbuf_get_reserve_tx()
	net_nbuf_get_reserve_data()
	net_nbuf_copy()
	net_nbuf_copy_all()
	net_nbuf_push()
	net_nbuf_append()
	net_nbuf_write()
	net_nbuf_insert()

Following convinience functions have not been changed
	net_nbuf_append_u8
	net_nbuf_append_be16
	net_nbuf_append_be32
	net_nbuf_insert_u8
	net_nbuf_insert_be16
	net_nbuf_insert_be32
	net_nbuf_write_u8
	net_nbuf_write_be16
	net_nbuf_write_be32
so they call the base function using K_FOREVER. Use the
base function if you want to have a timeout when net_buf
is allocated.

Change-Id: I20bb602ffb73069e5a02668fce60575141586c0f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-08 10:12:35 +02:00
Tomasz Bursztyka 028896063f drivers/console/telnet: Select TCP when telnet is selected
Thus users won't have to first enable network stack and then telnet.

Change-Id: I30cb2b9debee3feaf804f9a70f9d3f90758f5f17
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 13:02:11 +00:00
Tomasz Bursztyka c5644fba20 drivers/console/telnet: Add ground support for telnet commands
This is the skeleton for such support. Let's see if this will be needed
and thus extended in the future.

For now, it's disabled by default, not advised to be enabled.
It supports AYT, AO and DO/SUPR_GA. This is very limited and only there
to show how it could be handled.

Change-Id: I736bfa23145e9b727af08db682ab001f494f8c8d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 1d9402b3e3 drivers/console/telnet: Provide minimal input handling.
Telnet "Interpret As Command" (IAC) code is ignored.

Change-Id: I882397389d77b8adfcbce62fbd9654c0b0412ae3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 2f1af492ee console/shell: Switch to generic console input
Let's use the generic console input type now. This will be useful for
other console input drivers such as telnet.

Change-Id: I787a1e9d86481d5f8c4803453726d9042a89dea4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 3e65158936 drivers/console: Making console input generic
Input line length can be modified via Kconfig.

Change-Id: I3423fce9814e04b11d11e5d391f85fe1efbe8d17
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka fb9810978f drivers/uart_console: Fix tiny style issues
Basically missing {} on if statements.
Taking the opportunity to remove a useless switch.

Change-Id: Ic6b3951dfc257cb46d858ebcd12bdf1b4e7ff997
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Tomasz Bursztyka 01e70f4189 drivers/console: Add a basic telnet console
Telnet is started as an application, as it requires the net stack to be
ready. It will listen to any IP address on both protocols (IPv4, IPv6),
depending of course on which one is enabled.

Current behavior is very basic, as it does not handle any telnet
command (IAC). These will be silently ignored.

Jira: ZEP-1601

Change-Id: Id50656f23e6347bbbc893416953f1ba7116ef87d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:52 +02:00
Tomasz Bursztyka 4984ca742a drivers/console: Removing non existing Kconfig source
Change-Id: I89fdc6f702f3ea39822c6fbf6fce93e3eb77261c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:52 +02:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Anas Nashif 6b65dcefd2 legacy: Move TICKS_UNLIMITED -> K_FOREVER
Change-Id: Ic1e73959a3444bc6e015e341899c75b1ef850189
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:35 +00:00
Carles Cufi 0e650d4eaf drivers: rtt: Lock interrupts around RTT Write
Since RTTWriteNoLock is not thread-safe or preemptable, it is necessary
to lock interrupts around the calls to it.

Change-id: I38b7e37a0f46e77bf82c1e07d549414393e84a51
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-01-05 13:32:11 +01:00
Anas Nashif 7297f5db88 shell: move shell to its own subsystem
This moves the shell component into its own subsys and groups all
related files and options into a single place.

Additionally, one Kconfig option will now be required to enable the
shell:

 CONFIG_CONSOLE_SHELL=y

The header files was also moved to include/shell/shell.h and can be now
referenced with

 #include <shell/shell.h>

instead of

 #include <misc/shell.h>

Updated documentation as well.

Change-Id: Iffbba4acfa05408055e9fd28dffa213451351f94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 19:35:11 +00:00
Flavio Santes 3ec300fd94 shell: Init structure and add the ARG_UNUSED macro
The shell_cmd structure has three parameters and only two were
initialized. So, this commit initializes the remaining parameter
and also adds the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: I667a4e9839ec5acd526df0bb465beb2062518315
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:53 +00:00
Flavio Santes 0a1c29cda4 driver: Add ARG_UNUSED to console and uart drivers
This patch adds the ARG_UNUSED macros to some function
arguments to avoid compiler warnings.

Change-Id: I628aea55d98cf8519c046ae5835e95cfa70a973f
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:47 +00:00
Flavio Santes b04cdcd6e6 drivers: Remove legacy nanokernel.h include
This commit replaces the nanokernel.h include by kernel.h.

Change-Id: Ib42fbf2d9f77a73c0831f569b3dbbfb342ea2e1d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-04 14:59:37 -06:00
Carles Cufi 5f1c6ee2c8 console: Add a Segger RTT console driver
The Real Time Terminal functionality of the Segger J-Link
debug probe and software suite allows applications to write
to a certain RAM area that is read in real-time by the
debugger. This is specially useful when a UART is not
available to provide a console.
This commit adds a console driver that outputs over an RTT
"connection".

Change-Id: Ifce8020060e9f519a61f3f1fbe9f56f98da2ef7f
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-03 15:24:39 +00:00
Baohong Liu fa2d38e395 drivers: console: use unified kernel API
Change-Id: I2184f0565a9a4f2ebfdff1f57afc22ce36fe0646
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-30 23:49:04 +00:00
Vincenzo Frascino f3a9241045 console: Fix unreachable code condition
This patch fixes an unreachable code condition in the uart_console
driver.

If UART_CONSOLE_DEBUG_SERVER_HOOKS was not defined
handled_by_debug_server in console_out was always 0.

This issue was reported by Coverity (CID 131627).

Change-Id: I4376c3e5b3e68220218df6aabd91b6a8900ca31f
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-16 13:30:11 +00:00