Commit Graph

29788 Commits

Author SHA1 Message Date
Gregory Nutt
6a3800f611 There can be a failure in IOB allocation to some asynchronous behavior caused by the use of sem_post(). Consider this scenario:
Task A holds an IOB.  There are no further IOBs.  The value of semcount is zero.
Task B calls iob_alloc().  Since there are not IOBs, it calls sem_wait().  The v
alue of semcount is now -1.

Task A frees the IOB.  iob_free() adds the IOB to the free list and calls sem_post() this makes Task B ready to run and sets semcount to zero NOT 1.  There is one IOB in the free list and semcount is zero.  When Task B wakes up it would increment the sem_count back to the correct value.

But an interrupt or another task runs occurs before Task B executes.  The interrupt or other tak takes the IOB off of the free list and decrements the semcount.  But since semcount is then < 0, this causes the assertion because that is an invalid state in the interrupt handler.

So I think that the root cause is that there the asynchrony between incrementing the semcount.  This change separates the list of IOBs:  Currently there is only a free list of IOBs.  The problem, I believe, is because of asynchronies due sem_post() post cause the semcount and the list content to become out of sync.  This change adds a new 'committed' list:  When there is a task waiting for an IOB, it will go into the committed list rather than the free list before the semaphore is posted.  On the waiting side, when awakened from the semaphore wait, it will expect to find its IOB in the committed list, rather than free list.

In this way, the content of the free list and the value of the semaphore count always remain in sync.
2017-05-16 11:03:35 -06:00
Jussi Kivilinna
a6e556d31c I had to make following change to fix interrupt context syslog (INTBUFFER untested) 2017-05-16 10:56:49 -06:00
Gregory Nutt
9fb2fed90e Merge remote-tracking branch 'origin/master' into ieee802154 2017-05-16 08:05:38 -06:00
Anthony Merlino
2393217bca Merged in merlin17/nuttx/ieee802154 (pull request #371)
wireless/ieee802154: Restructuring of MAC notifications. Simplifes some interfaces

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-05-16 14:03:27 +00:00
EunBong Song
5ef00f0b91 drivers/bch: BCH character driver bch_ioctl() always returns -ENOTTY for DIOC_GETPRIV command. It should returns OK if DIOC_GETPRIV command succeeds. 2017-05-16 08:01:05 -06:00
Lederhilger Martin
b8e7d5c455 I had the problem that the transmit FIFO size (= actual elements in FIFO) was slowly increasing over time, and was full after a few hours.
The reason was that the code hit the line "canerr("ERROR: No available mailbox\n");" in stm32_cansend, so can_xmit thinks it has sent the packet to the hardware, but actually has not. Therefore the transmit interrupt never happens which would call can_txdone, and so the size of the FIFO size does not decrease.

The reason why the code actually hit the mentioned line above, is because stm32can_txready uses a different (incomplete) condition than stm32can_send to determine if the mailbox can be used for sending, and thus can_xmit forwards the packet to stm32can_send. stm32can_txready considered mailboxes OK for sending if the mailbox was empty, but did not consider that mailboxes may not yet be used if the request completed bit is set - stm32can_txinterrupt has to process these mailboxes first.

Note that I have also modified stm32can_txinterrupt - I removed the if condition, because the CAN controller retries to send the packet until it succeeds. Also if the condition would not evaluate to true, can_txdone would not be called and the FIFO size would not decrease also.
2017-05-16 07:47:18 -06:00
Gregory Nutt
56c8456ff0 Update some comments. 2017-05-16 07:38:57 -06:00
Anthony Merlino
06634afbe0 wireless/ieee802154: Restructuring of MAC notifications. Simplifes some interfaces 2017-05-15 21:44:57 -04:00
Gregory Nutt
914c5dad0c TCP: An RST recevied suring the 3-way handshake requires a little more clean-up 2017-05-15 08:10:43 -06:00
Juha Niskanen
34e68a569b drivers: rename newly introduced up_i2creset to I2C_RESET 2017-05-15 07:22:17 -06:00
Juha Niskanen
b9a769d65d drivers: fix some bad NULL checks 2017-05-15 07:20:32 -06:00
Gregory Nutt
17e9a88d0d Merge branch 'ieee802154' 2017-05-14 16:37:55 -06:00
Gregory Nutt
b10d2bbc8c Merge remote-tracking branch 'origin/master' into ieee802154 2017-05-14 16:37:10 -06:00
Anthony Merlino
2cf94a62d5 Merged in merlin17/nuttx/ieee802154 (pull request #370)
Ieee802154

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-05-14 22:33:48 +00:00
Anthony Merlino
8ec0b71a59 wireless/ieee802154: Updates configuration settings 2017-05-14 17:59:19 -04:00
Anthony Merlino
2b5e415fab wireless/ieee802154: Starts implementing START.request primitive 2017-05-14 17:55:15 -04:00
Gregory Nutt
aa57fb159d TCP: Send RST if applicaiton 'unlistens()' before we complete the connection sequence. 2017-05-14 13:30:59 -06:00
Gregory Nutt
8acfea1197 Fix some typos 2017-05-14 12:14:31 -06:00
Simon Piriou
8d2a3f4856 Merged in spiriou/nuttx/photon_telnet (pull request #369)
photon/wlan: disable network logs and add nsh over telnet

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-05-14 18:13:11 +00:00
Simon Piriou
7e75d61ea0 photon/wlan: disable network logs and add nsh over telnet 2017-05-14 19:33:44 +02:00
Gregory Nutt
93d73b14ab Merge branch 'synack' 2017-05-14 11:00:47 -06:00
Gregory Nutt
d339ba9e0e TCP: Fix some potential error conditions that could result from deferring the connection until the full 3-way handshake has completed. 2017-05-14 10:56:25 -06:00
Simon Piriou
8dc7f6d79e tcp: wait for 3-Way Handshare before accept() returns 2017-05-14 09:08:32 -06:00
Gregory Nutt
fa649df52e Photon: Small update from Simon Piriou. 2017-05-14 08:39:53 -06:00
Gregory Nutt
06db5614e7 Fix a warning about can.o appearing twice in the same rule. 2017-05-13 18:05:40 -06:00
Gregory Nutt
a52967a772 Syslog interrrupt buffer: eliminate a warning about an uninitialized variable; simply some related logic. 2017-05-13 17:40:46 -06:00
Matias v01d
820ef7059e libc/wchar: Versions mbrlen and mbsrtowcs taken and adapted from FreeBSD code (at https://github.com/freebsd/freebsd/) 2017-05-13 17:07:40 -06:00
Matias v01d
7cc2ee25ec libc/wchar: Versions mbrlen and mbsrtowcs taken and adapted from FreeBSD code (at https://github.com/freebsd/freebsd/) 2017-05-13 17:06:58 -06:00
Gregory Nutt
7fd08a60a3 Move prototype from nuttx/include/nuttx/arch.h to apps/include/platform/cxxinitialize.h 2017-05-13 16:53:55 -06:00
Gregory Nutt
b0fda33e13 Kconfig: Rename CONFIG_ARM_TOOLCHAIN_IAR to CONFIG_ARCH_TOOLCHAIN_IAR 2017-05-13 16:01:38 -06:00
Gregory Nutt
27805315f4 Tiva I2C: Correct an in conditional compilation 2017-05-13 14:01:42 -06:00
Gregory Nutt
6e4918c557 Remove CONFIG_ARM_TOOLCHAIN_GNU; replace with CONFIG_ARCH_TOOLCHAIN_GNU 2017-05-13 13:28:15 -06:00
Alan Carvalho
c2e8d2e51b Merged nuttx/nuttx into master 2017-05-13 16:24:59 -03:00
Gregory Nutt
7fe112fe4c Kconfig/deconfigs: Add CONFIG_ARCH_TOOLCHAIN_GNU to indicate that the toolchain is based on GNU gcc/as/ld. This is in addition to the CPU-specific versions of the same definition. 2017-05-13 11:44:12 -06:00
Gwenhael Goavec-Merou
02535be36a STM32F410. Add support for STM32Fr10. STM32F410 is a version of STM32F4 with 32 KB of RAM and 62 or 128 KB of flash. 2017-05-13 08:40:09 -06:00
Alan Carvalho
d30b9dd55d Merged nuttx/nuttx into master 2017-05-13 09:20:41 -03:00
David Sidrane
c4a2e1399b Merged in david_s5/nuttx/upstream_kinetis (pull request #368)
kinetis:K66 GPIO and pin mux cleanup

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-05-13 10:37:20 +00:00
David Sidrane
69a8aecbc8 kinetis:K66 define ALT1 to match ref manual 2017-05-12 17:21:54 -10:00
David Sidrane
700e4ff5b6 kinetis:K66 fixed TMP2_CH1 definition 2017-05-12 17:03:27 -10:00
Alan Carvalho
0e4d341487 Merged in acassis/nuttx_acassis/canard (pull request #367)
Fix the libcanard link version to get it compiling without errors.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-05-12 20:21:46 +00:00
Alan Carvalho de Assis
6811e18980 Fix the libcanard link version to get it compiling without errors. 2017-05-12 16:59:44 -03:00
Gregory Nutt
14ae6df182 locale.h: Add a bogus definition of locale_t 2017-05-12 10:13:18 -06:00
Gregory Nutt
332ab0359e Merged can_bus into master 2017-05-12 09:35:19 -06:00
Gregory Nutt
7698790be1 Changes from review of last PR 2017-05-12 09:04:52 -06:00
Gregory Nutt
f981191ac9 Merge branch 'can_bus' of bitbucket.org:nuttx/nuttx into can_bus 2017-05-12 08:59:57 -06:00
Gregory Nutt
fc7c3f5328 syslog: I think this might speed upt the CR-LF scan in syslog_dev_write(). 2017-05-12 08:50:56 -06:00
Alan Carvalho de Assis
853d332b6c Move CAN subsystem to its own directory and put device drivers there
Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com>
2017-05-12 11:48:47 -03:00
Gregory Nutt
c84a3e3519 Bitbucket Issue 47: Some of last syslog changes needed to be condition on #ifdef CONFIG_SYSLOG_BUFFER in order to be built without syslog buffering enabled. 2017-05-12 07:58:11 -06:00
Juha Niskanen
ac29d94d9c Merged in juniskane/nuttx_stm32l4/stm32l4_serial_pr (pull request #365)
STM32L4: port stm32l4_serial_get_uart function from STM32F7

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-05-12 13:43:36 +00:00
Gregory Nutt
3587a010c3 Merge branch 'ieee802154' 2017-05-12 07:36:08 -06:00