Ivan Mikhaylov
fdab66958e
uart: add 4800 baud speed
...
Signed-off-by: Le Jin <le.jin@siemens.com >
Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com >
2022-08-05 12:04:23 -07:00
Ivan Mikhaylov
4450073721
uart: disable timeout on read <= 0
...
Signed-off-by: Le Jin <le.jin@siemens.com >
Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com >
2022-08-05 12:04:23 -07:00
Ivan Mikhaylov
307a6f3bdd
mux: add mux interface
...
Add mux_init_reg interface with different mux modes for GPIO, UART, SPI,
I2C, PWM, AIO.
Signed-off-by: Le Jin <le.jin@siemens.com >
Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com >
2022-08-05 12:04:23 -07:00
Jan Kiszka
11e65ee9bf
uart: Convert rtscts and xonxoff in mraa_uart_settings into mraa_boolean_t
...
This aligns the getter with the setter (mraa_uart_set_flowcontrol).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com >
2021-06-29 11:48:16 -07:00
Jan Kiszka
aeb0b331b5
uart: Fix software flow control management
...
Rather than updating IXON/IXOFF in termios, mraa_uart_set_flowcontrol
was incorrectly issuing a stop or start character on mode changes. This
lead to spurious transmission in setups that actually wanted to disable
software flow control. And it prevented enabling it (which could have
been checked also by reading back the state via mraa_uart_settings).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com >
2021-06-29 11:48:16 -07:00
Benxi Liu
3b2f80b6e2
uart: fix xonxoff value in mraa_uart_settings()
...
the value of xonxoff(IXON|IXOFF) resides in the c_iflag field in
struct termios, not c_cflag.
Signed-off-by: Benxi Liu <bxliu@linux.alibaba.com >
2019-12-03 07:52:58 -08:00
Thomas Ingleby
170bdd104f
spdx: add spdx tags to most files
...
Large change that removes the duplicated MIT notice withe a spdx tag
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com >
2019-05-23 10:09:12 -07:00
Nicola Lunghi
45127e04b9
Add support for UART hardware flow control
...
This allows assigning platform pins to the CTS/RTS lines.
If provided, these will be muxed as UART when flow control is enabled.
Signed-off-by: Nicola Lunghi <nicola.lunghi@emutex.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-09-12 11:48:02 +02:00
Alex Tereschenko
822160b7de
uart.c: fix potential use of uninitialized variable
...
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-05-29 18:47:45 +02:00
Tapani Utriainen
a6f2464bb1
uart: add a function to query current UART settings
...
This patch adds a function to query UART settings in an unintrusive way.
It can be used using a uart index or a devpath and it strives to just
read out the settings without affecting the state of the UART.
Signed-off-by: Tapani Utriainen <tapani@technexion.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-05-28 08:11:21 +02:00
Tapani Utriainen
04c5593cef
uart.c: add function to return baudrate as an integer from a speed_t
...
Signed-off-by: Tapani Utriainen <tapani@technexion.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-05-28 08:11:21 +02:00
Tapani Utriainen
818ae995c2
uart.c: fix return value for invalid baudrates in uint2speed
...
This patch probably changes no functionality.
Before this patch the return value 0 was used for invalid baudrates in
uint2speed, but this is not a proper speed_t constant.
Instead the constant B0 is returned now, since on x86 and arm linux
architectures B0 is defined as 0.
Signed-off-by: Tapani Utriainen <tapani@technexion.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-05-28 08:11:21 +02:00
Tapani Utriainen
e7b0a3e809
uart: add a null pointer check before dereferencing plat->adv_func
...
Signed-off-by: Tapani Utriainen <tapani@technexion.com >
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
2017-05-15 21:00:34 +02:00
Jon Trulson
e0a0dac47b
uart: add tcsendbreak support
...
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
2017-05-08 21:15:33 +02:00
Brendan Le Foll
69fcd861a7
android-things: Peripheralmanager target build
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-04-24 14:42:54 -07:00
Brendan Le Foll
4c7616fe91
android-things: Prep for peripheralmanager support
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-04-24 14:42:54 -07:00
Nicola Lunghi Emutex
2ea68105f0
uart.c: Simple compiler error fixes
...
Signed-off-by: Nicola Lunghi Emutex <nicola.lunghi@emutex.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2017-02-06 21:34:13 +00:00
Brendan Le Foll
1c180e393c
uart.c: Allocate mem for dev->path to fix getDevicePath in raw mode
...
When mraa_init_uart_raw is called it places the path arg in dev->path. This
works in non raw mode because the path is statically in the device
configuration but in raw mode this is a dynamic address meaning that we need to
copy it. Fix this by simply copying the device path rather than relying on the
user keeping that string path in memory.
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-11-30 11:33:40 +01:00
Alex Tereschenko
9f03afbcbc
mock: implement UART functionality
...
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-10-25 12:04:04 +01:00
Alex Tereschenko
8a9efd1bcc
uart.c: add replace functions used by mock
...
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-10-25 12:04:04 +01:00
Alex Tereschenko
1b3a9371a1
uart.c: rework mraa_uart_init_raw to use common cleanup block
...
This will align it with spi.c and make it easier to introduce
a replace function.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-10-25 12:04:04 +01:00
Alex Tereschenko
1af737f3d9
mock: mraa with mock platform now works in Windows under MSYS2
...
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-07-05 19:32:58 +01:00
wda2945
1ebe377487
uart.c: Improve error handling
...
Changed syslog messages and some error returns.
Signed-off-by: Martin G Lane-Smith <mlanesmith@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-04-15 14:02:02 +01:00
Shiran Ben-Melech
cae63bbd52
firmata: Added option to set uart non blocking state
...
Signed-off-by: Shiran Ben-Melech <shiran.ben-melech@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-03-22 18:12:29 +00:00
Bernd Kuhls
7fce2e2a3a
uart.c: fix build with musl libc
...
musl does not define CMSPAR on all archs, patch inspired by
http://git.alpinelinux.org/cgit/aports/plain/main/freerdp/musl-fix.patch
musl needs sys/select.h to provide fd_set.
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-02-02 10:37:31 +00:00
Henry Bruce
63604ef5cc
uart: Added timeout support for uart read
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-01-06 10:38:51 +00:00
Srinivas Kandagatla
38aa9e8fe6
uart.c: make use of no_bus_mux flag
...
This patch makes use of no_bus_mux flag in mraa_board_t to skip
unnessary mux checks.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-14 11:00:04 +00:00
Alex Tereschenko
2dd46494ff
uart.c: fixed typo in debug output
...
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-11-18 13:55:53 +00:00
damcclos
c89b04eb19
uart.c: fix to UART even parity
...
Signed-off-by: David McCloskey <davmcclo@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-10-26 16:00:18 +00:00
Brendan Le Foll
07343e2ee7
mraa: Remove global advance_func struct and place it in platform configuration
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:04 +01:00
Brendan Le Foll
cfff6c3c98
uart.c: Fix return value check for tcflush()
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-02 14:39:54 +01:00
Alex Tereschenko
6d39902a8a
uart.c: Fixed UART initialization, now we set and apply defaults
...
Closes #221 .
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-07-22 11:07:04 +01:00
Thomas Ingleby
fd50ea087b
uart: fix issue where a index is checked before set
...
Related to #152
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-06-29 19:51:34 +01:00
Brendan Le Foll
b4655b250b
uart.c: Fix some wrong return checks
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-06-02 08:42:37 +01:00
Jon Trulson
b142f3fdda
uart: fix missing inversion that will clear all other flags
...
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-06-01 11:20:18 +01:00
Brendan Le Foll
236a8e9586
uart: make mraa_uart_get_dev_path return const char*
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-06-01 10:54:40 +01:00
Brendan Le Foll
347fd449f9
uart: Make C API use const where appropriate
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-06-01 09:36:00 +01:00
Thomas Ingleby
b982160ec5
uart: update C API
...
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-05-28 23:31:12 +01:00
Brendan Le Foll
19cad5cf24
uart: bunch of small changes to make C api work
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Brendan Le Foll
b02f8b4d50
uart.c: add missing return values
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Thomas Ingleby
4d86860e0c
uart: remove un-needed includes from uart.h
...
No need for many included
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-05-28 23:31:11 +01:00
Thomas Ingleby
7e47b05c8f
uart: move internal static function to top of file
...
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-05-28 23:31:11 +01:00
Brendan Le Foll
0a516ef3bf
uart: make initial dump of uart module
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Jon Trulson
88f3052d99
uart: use an unsigned int for baud rate rather than speed_t
...
uart.c contains a static conversion function that will translate known
baud rates into their speed_t counter parts. If an unsupported baud
rate is selected, a diagnostic will be emitted via syslog and a
default of B9600 will be chosen.
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Jon Trulson
c30457e434
uart: add capability to check if data can be read from device
...
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Jon Trulson
cf14939cca
uart: add uart device read and write functionality
...
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Jon Trulson
6d269eeabd
uart: add uart device open and close functionality
...
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Jon Trulson
bdadbb8b01
uart: add fd (file descriptor) to uart context
...
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-05-28 23:31:11 +01:00
Jon Trulson
dd807308ac
uart.c: mraa_uart_get_dev_path return NULL on error
...
Signed-off-by: Jon Trulson <jtrulson@ics.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-02-19 10:48:02 +00:00
Thomas Ingleby
25bd897ec5
uart: use const char* instead of plain char*
...
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-01-20 17:14:12 +00:00