Commit graph

20 commits

Author SHA1 Message Date
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
Peter Bigot
02ae343100 treewide: use full path to uart.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
Pavel Kral
51eb4572f5 subsystem: console: tty init checks and support for polled-only devices
This patch add tty runtime initialization check for console support
routines. Without it callers of routines API are not aware that
initialization of tty was failed. This patch basically checks
availability of console device and also its support for
interrupt driven transfers if routines are configured to use it.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2019-09-08 12:43:49 +02:00
Anas Nashif
52b3d2b671 cleanup: include/: move tty.h to console/tty.h
move tty.h to console/tty.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
169589221d cleanup: include/: move console.h to console/console.h
move console.h to console/console.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
Paul Sokolovsky
0925411356 tty: Remove buffer params from tty_init()
Let's have more orthogonal and cleaner API, where buffers are
configured by tty_set_rx_buf/tty_set_tx_buf, and only them. It
means that newly initialized tty starts in unbuffered mode, which
is somewhat a sidestep from a main usecase behind tty, which is
buffered operation, but again, having a cleaner API (and good
docs, explaining users how it should be and what they should do)
prevails.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-12-20 12:21:49 +01:00
Paul Sokolovsky
ed852e8b4a subsys: console: Split tty definitions into tty.h, to form its own API
This patch proceeds with the separation of older serial console
subsystem into device-independent console subsytem and buffered
serial device ("tty") API.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-30 08:05:40 -08:00
Paul Sokolovsky
6203020bfd subsys: console: Switch to POSIX-like read/write interface
Tty device gets only read/write calls, but console retains
getchar/putchar for convenience.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-04 17:31:39 -05:00
Paul Sokolovsky
680085b3e2 subsys: console: tty: Allow to specify receive timeout
This allows to specify receive timeout, instead of previously
hardcoded K_FOREVER value. K_FOREVER is still the default, and can
be changes after tty initialization using tty_set_rx_timeout() call,
and timeout is stored as a property of tty. (Instead of e.g. being
a param of each receive call. Handling like that is required for
POSIX-like behavior of tty).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-11-04 17:31:39 -05:00
Paul Sokolovsky
ca8aea1a62 subsys: console: Split serial tty handling to a separate module
Before going further for API refactoring in console subsys, makes
sense to split "tty" implementation from "console" implementation,
to make it clearer that "console" is just a "tty" instantiated on
a particular UART device.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-10-03 16:40:49 +02:00
Paul Sokolovsky
95b64fb776 subsys: console: Refactor code to allow per-UART "tty" wrapper
Instead of having just one static "UART console" device, allow to
instantiate buffered, interrupt-driven POSIX-like "tty" wrapper for
any underlying device. Then, use this functionality to provide
compatible "console API".

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-16 06:18:50 -07:00
Paul Sokolovsky
c524ff6b8c subsys: console: getchar: Use consistent var names for RX path
Initially, there was support only for buffered input, and adhoc var
names used. Later, buffered output support was added, with variables
consistently using "tx_" prefix. Now, rename the original RX path
to use symmetric "rx_" prefix.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-06-11 17:41:44 -04:00
Andy Ross
ca9a98e6e2 samples/subsys/console: Remove unused tx_sem semaphore
This was declared but unused.  And recent toolchains have apparently
started warning on it leading to sanitycheck failures.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-19 07:00:55 +03:00
Aska Wu
fa934009cb subsys: console: Fix the buffer size checking
Fix the problem that no compiler error even the buffer size is not power
of 2.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-12-10 19:49:02 -05:00
Paul Sokolovsky
6b5a7238b2 subsys: console: Fix signed vs unsigned char issues.
May lead to warnings/errors with pedantic compilers (like LLVM).

Jira: ZEP-2170

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-22 08:43:31 -05:00
Paul Sokolovsky
3cb13b9687 subsys: console: Add buffered output support to console subsystem
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-15 15:56:56 -04:00
Kumar Gala
6da829690f subsys: 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: Icbf9e542b23208890a3a32358447d44cdc274ef1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:36:22 -05:00
Johan Hedberg
253a7f7064 Revert "subsys/console: Yield on char availability."
This reverts commit 4e2eaec268.

It's invalid to call k_yield from ISR. In fact, it'll trigger an
__ASSERT.

Change-Id: Icc7b81c07c2e7df63fe7d5029fac446ac6fe508b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-06 14:56:23 +03:00
Paul Sokolovsky
4e2eaec268 subsys/console: Yield on char availability.
If this is not done, there is common pattern that on big input block
(e.g. from a clipboard paste), IRQ routine is called in a tight loop,
leading to circular buffer overflow.

Change-Id: I69a7aa78081b8d74652406f3b3a577ddaf4c5f6f
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-06 00:59:47 +00:00
Paul Sokolovsky
542c2b93d0 subsys: console: Add pull-style console API support.
This change introduces console_getchar() and console_getline() API
calls which can be used to get pending console input (either one
char or whole line), or block waiting for one. In this regard, they
are similar to well-known ANSI C function getchar/gets/fgets, and
are intended to ease porting of existing applications to Zephyr, and
indeed, these functions (shaped as an external module) are already
used by few applications.

The implementation of the functions is structured as a new "console"
subsystem. The intention is that further generic console code may be
pulled there instead of being in drivers/console/. Besides the
functions themselves, initialization code and sample applications
are included.

At this time, there're may limitations of how these functions can
be used. For example, console_getchar() and console_getline() are
mutually exclusive, and both are incompatible with callback
(push-style) console API (and e.g. with console shell subsystem
which uses this API). Again, the intention is to make a first step
towards refactoring console subsystem to allow more flexible
real-world usage, better reusability and composability.

Change-Id: I3f4015bb5b26e0656f82f428b11ba30e980d25a0
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-01 20:44:17 +00:00