Xiang Xiao
4465cccdbd
drivers/serial/serial.c: Don't overwrite nwritten unconditionally on UART write failure.
2018-08-26 09:56:02 -06:00
xuanlin
c8df5f3df3
drivers/serial/serial.c: Support UART direct write for non console device
2018-08-26 09:47:25 -06:00
ligd
4c4d2b54a3
Send poll() notification when the Tx buffer is flushed
2018-08-26 09:39:16 -06:00
Gregory Nutt
55b7938f0a
drivers/serial/Kconfig: Make feature dependent on CONFIG_BUILD_FLAT.
2018-08-26 08:56:16 -06:00
ligd
11f8dc735c
Squashed commit of the following:
...
drivers/serial: Add Ctrl-C/Ctrl-X support. This is an initial working implementation that still requires that several details be resolved.
sched/task/task_start.c: Add default signal action to SIGKILL.
2018-08-26 08:49:08 -06:00
Gregory Nutt
8fdbb1e0a4
Elimate use of the non-standard type systime_t and replace it the equivalent, standard type clock_t
...
Squashed commit of the following:
sched: Rename all use of system_t to clock_t.
syscall: Rename all use of system_t to clock_t.
net: Rename all use of system_t to clock_t.
libs: Rename all use of system_t to clock_t.
fs: Rename all use of system_t to clock_t.
drivers: Rename all use of system_t to clock_t.
arch: Rename all use of system_t to clock_t.
include: Remove definition of systime_t; rename all use of system_t to clock_t.
2018-06-16 12:16:13 -06:00
Gregory Nutt
c74e9fd6da
Update a readme and some comments.
2018-05-27 15:13:54 -06:00
Gregory Nutt
f3392e0a6c
drivers/serial: Add a timeout to uart_tcdrain(). Even if tcflush() is used to discard buffered data, the close() can still hang if (a) hardware flow control is enabled, (b) CTS == 1, and (c) there is data stuck in the hardware Tx FIFO. tcflush() does not currently clear the MCU serial drivers' hardware Tx FIFOs. This is a workaround for that.
2018-05-27 11:39:34 -06:00
Gregory Nutt
759e510c28
Per Matias Edlund: I recently used the tcflush function and found that it failed with ENOTTY. The reason is that the TCFLSH case in the function uart_ioctl in the file drivers/serial/serial.c does not update the ret value." On success, the TCFLSH IOCTL logic needs to explicitly set the return value (ret) to zero.
2018-03-26 13:54:47 -06:00
Dmitriy Linikov
a8c58607e9
Merged in hardlulz/modem-3.0-nuttx/fix-sem-EINTR (pull request #603 )
...
Added ECANCELED condition to DEBUGASSERT-s checking sem_wait result
Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-02-20 18:24:53 +00:00
Frank Benkert
c6942f6137
drivers/serial/serial.c: Optimize wait time in tcdram() for buffer emptying
...
According to the specification, the close function must wait until all data
has been written before it closes the file (except O_NONBLOCK is set). The
maximum waiting time for this is not specified.
To be able to edit the file list of the process, the close function has to lock
the file list semaphore. After that the close function of the serial driver is
called.
Waiting for the complete transmission of all data is done in the serial driver.
This causes the semaphore to remain locked until all data has been sent.
However, no other thread of the process can edit the file list for that time
(open, close, dup2, etc.). This is not optimal in a multithreaded environment.
Therefore, we have to keep the waiting time within the driver as short as possible.
2017-11-02 08:53:14 -06:00
Gregory Nutt
85a1a3cc98
drivers/usbdev: Correct input flow control logic when watermarks are not enabled. Problem not by and change based on suggestion by Juha Niskanen.
2017-10-18 06:49:11 -06:00
Gregory Nutt
936df1bcb5
Adds new OS internal functions nxsig_sleep() and nxsig_usleep. These differ from the standard sleep() and usleep() in that (1) they don't cause cancellation points, and (2) don't set the errno variable (if applicable). All calls to sleep() and usleep() changed to calls to nxsig_sleep() and nxsig_usleep().
...
Squashed commit of the following:
Change all calls to usleep() in the OS proper to calls to nxsig_usleep()
sched/signal: Add a new OS internal function nxsig_usleep() that is functionally equivalent to usleep() but does not cause a cancellaption point and does not modify the errno variable.
sched/signal: Add a new OS internal function nxsig_sleep() that is functionally equivalent to sleep() but does not cause a cancellaption point.
2017-10-06 10:15:01 -06:00
Gregory Nutt
9568600ab1
Squashed commit of the following:
...
This commit backs out most of commit b4747286b1
. That change was added because sem_wait() would sometimes cause cancellation points inappropriated. But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.
In the OS, all calls to sem_wait() changed to nxsem_wait(). nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.
In all OS functions (not libraries), change sem_wait() to nxsem_wait(). This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.
sched/semaphore: Add the function nxsem_wait(). This is a new internal OS interface. It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt
42a0796615
Squashed commit of the following:
...
sched/semaphore: Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable. Changed all references to sem_post in the OS to nxsem_post().
sched/semaphore: Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable. Changed all references to sem_destroy() in the OS to nxsem_destroy().
libc/semaphore and sched/semaphore: Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable. Changed all references to sem_setprotocol in the OS to nxsem_setprotocol(). sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Gregory Nutt
83cdb0c552
Squashed commit of the following:
...
libc/semaphore: Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable. Changed all references to sem_getvalue in the OS to nxsem_getvalue().
sched/semaphore: Rename all internal private functions from sem_xyz to nxsem_xyz. The sem_ prefix is (will be) reserved only for the application semaphore interfaces.
libc/semaphore: Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable. Changed all references to sem_init in the OS to nxsem_init().
sched/semaphore: Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.
sched/semaphoate: Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Gregory Nutt
bd027b9019
serial.c: Use common TX drain logic when closing a driver as with the TCDRAIN IOCTL.
2017-08-01 10:14:24 -06:00
Gregory Nutt
4f0238339e
serial.c: Finish implementation of TCDRAIN. Based partly on logic from Sebastien Lorquet.
2017-08-01 07:39:08 -06:00
Sebastien Lorquet
e22912db37
drivers/serial/serial.c: Add support for TCFLUSH
2017-08-01 06:30:52 -06:00
Gregory Nutt
d3b9f5b37f
Syslog buffering: Use IOBs to buffer data, not an on-stack buffer
2017-05-10 17:36:08 -06:00
Stefan Kolb
591f35be87
I discovered a problem in the file drivers/serial/serial.c concerning the function uart_close(…). In the case that a serial device is opened with the flag O_NONBLOCK the function uart_close(…) blocks until all data in the buffer is transmitted. The function close(…) called on an handle opened with O_NONBLOCK should not block. The problem occurred with a CDC/ACM device.
2017-05-10 07:59:58 -06:00
Gregory Nutt
08c001196b
drivers/: Remove all explicit use of 'hidden' macro _info. Code must never use this directly. Code must always use a debug macro such as info which is basic on _info but can be appropriately filtered.
2017-01-15 13:00:50 -06:00
Gregory Nutt
4fcbe8e410
drivers: Disable priority inheritance on all semaphores used for signaling
2016-11-03 11:00:47 -06:00
Gregory Nutt
47b043df1e
drivers/serial.c: Make sure that priority inheritance is not enabled for the signaling semaphores used in the serial driver.
2016-11-03 08:16:59 -06:00
Gregory Nutt
eaaa69da0a
serial.c: Fix an error in FIONWRITE calculation
2016-07-26 06:47:53 -06:00
Gregory Nutt
e0b4a10dfa
drivers/serial/pty.c, serial.c, usbdev/cdcacm.c, include/nuttx/fs/ioctl.h: Fix FIONWRITE and add FIONSPACE. All implementations of FIONWRITE were wrong. FIONWRITE should return the number of bytes waiting in the outgoing send queue, not the free space. Rather, FIONSPACE should return the free space in the send queue.
2016-07-25 14:06:32 -06:00
Gregory Nutt
9a8c3572db
serial.c: Fix a race condition noted by Stefan Kolb. Between the test if the TX buffer is full and entering a critical section, bytes may be removed from the TX buffer making the wait unnecessary. The unnecessary wait is an inefficiency, but not really a problem. But with USB CDC/ACM it can be a problem because the entire TX buffer may be emptied when we lose the race. If that happens that uart_putxmitchar() can hang waiting for data to be removed from an empty TX buffer.
2016-07-22 07:47:59 -06:00
Gregory Nutt
0c8c7fecf0
Add _ to the beginning of all debug macros to avoid name collisions
2016-06-16 12:33:32 -06:00
Gregory Nutt
efb02f2ef1
drivers/: Change some nerr() ERRORS to nwarn() WARNINGS. Anomolous network evernts are not errors.
2016-06-12 08:31:22 -06:00
Gregory Nutt
a1469a3e95
Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err()
2016-06-11 15:50:49 -06:00
Gregory Nutt
1cdc746726
Rename CONFIG_DEBUG to CONFIG_DEBUG_FEATURES
2016-06-11 14:14:08 -06:00
Gregory Nutt
fc3540cffe
Replace all occurrences of vdbg with vinfo
2016-06-11 11:59:51 -06:00
Paul A. Patience
f8f7b7582c
Silence some warnings
2016-05-26 14:06:13 -04:00
Gregory Nutt
0fb035f76b
Standardize some naming in code section comments
2016-02-21 18:09:04 -06:00
Gregory Nutt
2244ed46bc
nuttx/drivers: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
2016-02-14 07:32:58 -06:00
Gregory Nutt
ce2a0b6b51
Eliminate a warning
2016-01-06 10:05:39 -06:00
Max Neklyudov
d54a39832a
Implement high level DMA infrastructure for serial devices
2015-11-12 14:16:19 -06:00
Gregory Nutt
cf14f8d1b5
drivers/: Fixes to spacing and alignement
2015-10-10 10:41:00 -06:00
Gregory Nutt
0b12dbf95d
Fix some spacing problems
2015-10-04 15:04:00 -06:00
Paul A. Patience
3b89eabd50
Correct #if to #ifdef when the macro can be undefined. Fix bug in AT24XX driver: it should compare AT24XX_ADDRSIZE to 2.
2015-09-01 13:52:29 -04:00
Gregory Nutt
e4d2822af8
Make some file section headers more consistent with standard
2015-04-08 07:15:32 -06:00
Gregory Nutt
b83cea4f99
Back out 70cb75adaf3243478276cebf367c5f47c4725715
2015-03-13 10:40:09 -06:00
Gregory Nutt
3473bb1635
drivers/serial: Report correct number of bytes free in serial buffer with FIONWRITE. From Jussi Kivilinna.
2015-03-13 07:22:43 -06:00
Gregory Nutt
52aeabb4b2
Cosmetic changes
2015-01-02 13:59:47 -06:00
Gregory Nutt
33f7151cd9
Remove STM32-specific RX flow control logic from the upper level serial driver to the lower level STM32 serial driver
2014-12-27 09:45:45 -06:00
Gregory Nutt
32fd858dc6
Serial RX Flow Control: Fix a bunch of compile problems introduced into unbuilt, conditioned out logic
2014-12-27 08:15:41 -06:00
Gregory Nutt
aefde565d3
Serial Upper Half: Add watermarks to RX flow control logic
2014-12-27 07:43:06 -06:00
Gregory Nutt
623757d77c
Update TODO list and add REVISIT comment
2014-12-13 08:44:28 -06:00
Gregory Nutt
d09bb13833
In case a thread is doing a blocking operation (e.g. read()) on a serial
...
device, while it is being terminated by pthread_cancel(), then
uart_close() gets called, but the semaphore (dev->recv.sem in the above
example) is still blocked.
This means that once the serial device is opened next time, data will
arrive on the serial port (and driver interrupts handled as normal), but
the received characters never arrive in the reader thread.
This patch addresses the problem by re-initializing the semaphores on the
last uart_close() on the device.
2014-12-13 08:07:21 -06:00
Gregory Nutt
0ec5043a4e
Add an interface definition and upper half driver for a discrete joystick device
2014-11-27 17:42:16 -06:00
Gregory Nutt
5120d745fd
Fix some typos
2014-10-29 10:48:50 -06:00
Gregory Nutt
47d55c28dc
Mostly cosmetic changes
2014-09-04 10:28:38 -06:00
Gregory Nutt
320707fdfa
SAMA5: Fix bugs in timer/counter interrupts and one-shot timer
2014-08-10 10:47:38 -06:00
Gregory Nutt
b5efb9dd77
Add serial method so that lower half driver can provide RX flow control information. From Jussi Kivilinna
2014-05-08 09:01:14 -06:00
Gregory Nutt
3a1324741a
More trailing whilespace removal
2014-04-13 14:32:20 -06:00
Gregory Nutt
0ab6d8382f
SAMA5 TC: Debug instrumentation
2013-10-26 14:03:30 -06:00
Gregory Nutt
bc46b447dc
Fix all occurrences of "the the" in documentation and comments
2013-08-27 09:40:19 -06:00
Gregory Nutt
dd3c682443
SAMA5: Some improvements to the HSCMI card removal/insertion logic
2013-08-11 11:13:11 -06:00
Gregory Nutt
82b528e0c8
Serial FIONREAD, FIONWRITE, and TERMIOS I/O processing from Mike Smith, Andrew Tridgell, and and Lorenz Meier
2013-08-10 19:14:05 -06:00
patacongo
730dc3e202
Add missing implementation of O_NONBLOCK for serial writes
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5755 42af7a65-404d-4744-a932-0658087f49c3
2013-03-18 16:04:29 +00:00
patacongo
ad447766ff
Fix a readline bug. If a NUL is received, it would return end-of-file
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5633 42af7a65-404d-4744-a932-0658087f49c3
2013-02-10 00:46:27 +00:00
patacongo
cf411bec51
A spurious checkin... I just want to improve some code structure
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5597 42af7a65-404d-4744-a932-0658087f49c3
2013-02-02 01:50:34 +00:00
patacongo
11aa231cf0
drivers/serial.c: Fix some race conditions. Some bad things code happen if we lost a USB connection at certain times.
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5596 42af7a65-404d-4744-a932-0658087f49c3
2013-02-02 00:29:55 +00:00
patacongo
9a05ccdbbc
Last minute 6.25 change
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5595 42af7a65-404d-4744-a932-0658087f49c3
2013-02-01 22:51:34 +00:00
patacongo
1b94639432
Misc clean; mark assertions as non-returning; allow toolchain prefix to be overriden from make command line
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5591 42af7a65-404d-4744-a932-0658087f49c3
2013-01-31 23:29:34 +00:00
patacongo
cdbbfaa464
Fix readline return value; Add support for removable serial devices
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5589 42af7a65-404d-4744-a932-0658087f49c3
2013-01-31 16:52:20 +00:00
patacongo
df9a72994f
configs/xtrs/nsh and pashello now use kconfig-frontends and build Windows native
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5422 42af7a65-404d-4744-a932-0658087f49c3
2012-12-09 17:34:53 +00:00
patacongo
70b1c3f2f6
Make the lib/ subdirectory build more like other directories
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5025 42af7a65-404d-4744-a932-0658087f49c3
2012-08-13 22:27:06 +00:00
patacongo
b7a1b00c08
drivers/serial/serial.c open, read, write, and poll methods will not return a short transfer or an EINTR error if a signal is received while waiting (only)
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5022 42af7a65-404d-4744-a932-0658087f49c3
2012-08-12 17:37:04 +00:00
patacongo
5b7341f5db
drivers/, drivers/pipes, and drivers/serial file clean-up
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4944 42af7a65-404d-4744-a932-0658087f49c3
2012-07-15 14:56:25 +00:00
patacongo
be3ebf6201
More Kconfig files
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4632 42af7a65-404d-4744-a932-0658087f49c3
2012-04-18 19:17:30 +00:00
patacongo
e91f97ada2
drivers/serial: Don't disable Rx interrrupts on each character
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4631 42af7a65-404d-4744-a932-0658087f49c3
2012-04-18 17:08:27 +00:00
patacongo
1c1dee962d
A couple of fixes to common and STM32 serial handling to fix some data overrun conditions
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4550 42af7a65-404d-4744-a932-0658087f49c3
2012-04-02 01:02:41 +00:00
patacongo
34b7ebdf68
Move serial header files to include/nuttx/serial
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4500 42af7a65-404d-4744-a932-0658087f49c3
2012-03-21 19:47:23 +00:00
patacongo
2fe4ad52f8
Move file-system header files to include/nuttx/fs
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4499 42af7a65-404d-4744-a932-0658087f49c3
2012-03-21 18:01:07 +00:00
patacongo
e69cbad010
Add logic so that a RAM log can be used in place of a console device
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4380 42af7a65-404d-4744-a932-0658087f49c3
2012-02-11 03:50:52 +00:00
patacongo
95e415d274
Re-architect FAT data structures to support long file names
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3780 42af7a65-404d-4744-a932-0658087f49c3
2011-07-13 13:30:38 +00:00
patacongo
62d94bb3d6
Add wchar_t type; Add LPC17xx CAN driver from Lzyy; Fix serial bug reported by Lzyy
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3775 42af7a65-404d-4744-a932-0658087f49c3
2011-07-12 16:36:45 +00:00
patacongo
fff9db3c57
First set of changes to incorporate the RGMP port
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3595 42af7a65-404d-4744-a932-0658087f49c3
2011-05-12 17:42:01 +00:00
patacongo
9634f25391
Changing NuttX fixed size type names to C99 standard names -- things will be broken for awhile
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2343 42af7a65-404d-4744-a932-0658087f49c3
2009-12-15 14:25:14 +00:00
patacongo
9535a28d7a
Eliminate some hcs12 compile errors/warnings
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2329 42af7a65-404d-4744-a932-0658087f49c3
2009-12-13 15:13:37 +00:00
patacongo
9b04ee217e
Move some drivers to separate subdirectories
...
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2156 42af7a65-404d-4744-a932-0658087f49c3
2009-10-18 13:52:21 +00:00