Commit Graph

31235 Commits

Author SHA1 Message Date
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 fdd0dcc0b6 This commit adds internal versions of the signal interfaces:
sigtimedwait() -> nxsig_timedwait()
  sigwaitinfo()  -> nxsig_waitinfo()
  nanosleep()    -> nxsig_nanosleep()

The internal OS versions differ from the standard application interfaces in that:

  - They do not create cancellation points, and
  - they do not modify the application's errno variable

Squashed commit of the following:

    sched/signal:  Replace all usage of sigwaitinfo(), sigtimedwait(), and nanosleep() with the OS internal counterparts nxsig_waitinfo(), nxsig_timedwait(), and nxsig_nanosleep().

    sched/signal:  Add nxsig_nanosleep().  This is an internal OS version of nanosleep().  It differs in that it does not set the errno varaiable and does not create a cancellation point.

    sched/signal:  Add nxsig_timedwait() and nxsig_waitinfo().  These are internal OS versions of sigtimedwait() and sigwaitinfo().  They differ in that they do not set the errno varaiable and they do not create cancellation points.
2017-10-06 08:28:20 -06:00
Gregory Nutt aeb3944f0a fs/vfs and net/socket: fcntl() is not return success fail for F_SETFL. Reported by Jussi Kivilinna. 2017-10-06 08:27:38 -06:00
Jussi Kivilinna 7fc7cc9f8f drivers/input/cypress_mbr3108: Add missing variable for nxsem_wait return value 2017-10-06 07:30:04 -06:00
Gregory Nutt 21c97b16cf Revert "sem_wait.c edited online with Bitbucket. Fix some correct but useless code."
What was I thinking?  I missed that litle minus sign and the possibility that the errno might be some positive non-zero value.

This reverts commit 43880878e4.
2017-10-05 16:01:01 -06:00
Gregory Nutt 43880878e4 sem_wait.c edited online with Bitbucket. Fix some correct but useless code. 2017-10-05 21:55:24 +00:00
Gregory Nutt 8198ba6a6d This change renames all internal, private NuttX signal-related functions to use the prefix nxsig_ so that they cannot be confused with application interfaces that begin, primarily, with sig_
This is analogous to similar renaming that was done previously for semaphores.

Squashed commit of the following:

    sched/signal:  Fix a few compile warnings introduced by naming changes.

    sched/signal:  Rename all private, internal signl functions to use the nxsig_ prefix.

    sched/signal:  Rename sig_removependingsignal, sig_unmaskpendingsignal, and sig_mqnotempty to nxsig_remove_pendingsignal, nxsig_unmask_pendingsignal, and nxsig_mqnotempty to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_findaction and sig_lowest to nxsig_find_action and nxsig_lowest to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_allocatepingsigaction and sig_deliver to nxsig_alloc_pendingsigaction and nxsig_deliver to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_cleanup, sig_release, sig_releasependingaction, and sig_releasependingsignal to nxsig_cleanup, nxsig_release, nxsig_release_pendingaction, and nxsig_release_pendingsignal to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_tcbdispatch and sig_dispatch to nxsig_tcbdispatch and nxsig_dispatch to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_releaseaction and sig_pendingset to nxsig_release_action and nxsig_pendingset to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_initialize and sig_allocateactionblock to nxsig_initialize and nxsig_alloc_actionblock to make it clear that these are OS internal interfaces.
2017-10-05 13:25:25 -06:00
Gregory Nutt 7cc63f90d9 sched/semaphore: sem_trywait() modifies the errno value and, hence, should not be used within the OS. Use nxsem_trywait() instead. 2017-10-05 07:59:06 -06:00
Gregory Nutt 29b5b3667f sched/semaphore: sem_timedwait() is a cancellation point and, hence, cannot be called from within the OS. Created nxsem_timedwait() that is equivalent but does not modify the errno and does not cause cancellation. All calls to sem_timedwait() change to calls to nxsem_timedwait() in the OS. 2017-10-05 07:24:54 -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
Juha Niskanen 2997a49e51 Merged in juniskane/nuttx_stm32l4/stm32l4_rtc_pm_fixes_pr (pull request #502)
STM32L4 RTC, PM: small fixes to subseconds handling, ADC power-management hooks

* STM32L4 ADC: add PM hooks from Motorola MDK

* STM32L4 RTC: add up_rtc_getdatetime_with_subseconds

* STM32 RTC: workaround for potential subseconds race condition

    In all recent STM32 chips reading either RTC_SSR or RTC_TR is supposed to lock
    the values in the higher-order calendar shadow registers until RTC_DR is read.
    However many old chips have in their errata this silicon bug (at least F401xB/C,
    F42xx, F43xx, L15xxE, L15xVD and likely others):

    "When reading the calendar registers with BYPSHAD=0, the RTC_TR and RTC_DR
    registers may not be locked after reading the RTC_SSR register. This happens
    if the read operation is initiated one APB clock period before the shadow
    registers are updated. This can result in a non-consistency of the three
    registers. Similarly, RTC_DR register can be updated after reading the RTC_TR
    register instead of being locked."

* STM32L4 RTC: correct RTC_SSR and RTC_TR read ordering

    In all recent STM32 chips reading either RTC_SSR or RTC_TR is supposed to lock
    the values in the higher-order calendar shadow registers until RTC_DR is read.
    Change the register read ordering to match this and don't keep a workaround
    for a hypothetical race condition (not in any L4 errata, lets for once assume
    ST's silicon works as it is documented...)

* STM32L4 PM: remove useless #ifdefs and old non-L4 STM32 code

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-03 16:39:51 +00:00
Gregory Nutt 5c4d45a331 Documentation and comments updated to further enshrine exec() as an official NuttX interface. 2017-10-03 07:52:05 -06:00
Gregory Nutt 8e966546c1 syscall/: The non-standard interface exec() is now enshrined as a official NuttX API. I really dislike doing this but I think that this is probably the only want to load programs in the protected mode. It is currently used by some example code under apps/ that generate their own symbol tables for linking. Other file execution APIs relay on a symbol table provided by the OS. In the protected mode, the OS cannot provide any meaning symbol table for execution of code in the user-space blob so that is they exec() is really needed in that build case. And, finally, the interface is completely useless and will not be supported in the KERNEL build mode where the contrary is true: An application process cannot provide any meaning symbolic information for use in linking a different process. 2017-10-03 07:09:35 -06:00
Alan Carvalho de Assis 5512813157 stm32f103-minimum: Add ADC support on stm32f103-minimum board 2017-10-02 16:24:24 -06:00
Gregory Nutt bc2cded397 Squashed commit of the following:
binfmt: Fix some compilation issues introduced in previous changes.  Verfied with the STM32F4-Discovery ELF configuration.

    binfmt:  schedule_unload() is an internal OS function and must not alter the errno variable.

    binfmt:  unload_module() is an internal OS function and must not alter the errno variable.

    binfmt:  load_module() is an internal OS function and must not alter the errno variable.

    binfmt:  exec_module() is an internal OS function and must not alter the errno variable.
2017-10-02 15:30:55 -06:00
Gregory Nutt 3688ea2f90 Changes made to configurations to support changes to apps/examples/elf and nxflat. 2017-10-02 14:31:06 -06:00
Gregory Nutt 374f1bd46c binfmt: Don't schedule starthook if there are no constructors. 2017-10-02 14:04:50 -06:00
Gregory Nutt 9232da4af8 fs/vfs: Remove warning generated by fcntl() 2017-10-02 14:04:50 -06:00
Sebastien Lorquet 9ea215f2e4 Merged in slorquet/nuttx/mt25q (pull request #501)
Add support for Micron MT25Q series MT25Q128

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-02 18:33:54 +00:00
Gregory Nutt 6ccb974910 net/route: Fix an error in cache list management. 2017-10-02 08:10:12 -06:00
Sebastien Lorquet 152164dcaf commit b2ea300b6f broke the STM32L4 port for people not using the L496xx or L4A6xx. That was because stm32l4_sdmmc.h is included from the stm32l4.h global header, and this header fires an #error for other chips. I see that ALL stm32l4 have the same SDMMC except the stm32l4x2, which has none. 2017-10-02 07:43:39 -06:00
Gregory Nutt 0617f0bfb2 stdnoreturn.h: remove C++11 dependency. Applies to C too. 2017-10-02 07:38:43 -06:00
Gregory Nutt c76774cfb0 net/route: Add logic to mark a route as most-recently-used in the route cache. 2017-10-02 07:29:02 -06:00
Gregory Nutt c3bd4fd1d7 stdnoreturn.h: Definitions removed from compiler.h below here 2017-10-02 07:10:48 -06:00
Gregory Nutt c4ab155002 compiler.h: Fix some GCC warnings introduced for SDCC support. Basically a naming collision. 2017-10-02 07:09:31 -06:00
Gregory Nutt 89f3093590 tools/: configure.sh and configure.c should redirect stdout to /dev/null but should not suppress stderr output. 2017-10-01 15:41:59 -06:00
Gregory Nutt 08f2174d9f configs/z80sim: convert other configurations to default to Linux. 2017-10-01 15:00:29 -06:00
Gregory Nutt b1370c0fb6 Update README.txt files 2017-10-01 14:56:54 -06:00
Gregory Nutt 9eca03b9be tools/configure.sh: Another fix for the script. The last change only worked for Windows Cygwin; for Linux, it needed to remove some additional things from the defconfig file. 2017-10-01 14:24:57 -06:00
Gregory Nutt e505df2eb5 tools/configure.c: Duplicate new functionaity added to configure.sh. 2017-10-01 12:45:29 -06:00
Gregory Nutt 10eed5deef Mostly cosmetic changes from review of last PR. 2017-10-01 12:08:52 -06:00
Mateusz Szafoni 67300e23a0 Merged in raiden00/nuttx (pull request #500)
stm32_hrtim: add support for capture, chopper, deadtime and dump registers

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-01 17:52:39 +00:00
Gregory Nutt 13d2fe6edf tools/configure.sh: Add special support so that you can start with a a windows native configuration and install on a different host (and vice versa). 2017-10-01 11:49:17 -06:00
Gregory Nutt 3f46857918 include/: Add stdnoreturn.h 2017-10-01 10:39:30 -06:00
Gregory Nutt a8f36d6567 z80 Make.defs: Fixes dependency generation with newest SDCC compiler. 2017-10-01 10:32:08 -06:00
Gregory Nutt 94f3cb004f compilers.h: Add definitions for the C11 noreturn keyword. 2017-10-01 09:34:44 -06:00
Gregory Nutt a5f3e1e6d1 compiler.h, limits.h, types.h: Update SDCC/z80 files to include support for long long, inline, __FILE__, and __func__. 2017-10-01 09:02:53 -06:00
Gregory Nutt b436e3a2c8 A few more fixes for compilation with current SDCC compiler 2017-10-01 07:43:59 -06:00
Gregory Nutt ccabac3eb6 More fixes for compilation with current SDCC compiler 2017-09-30 15:28:04 -06:00
Gregory Nutt 7acc98727b Misc fixes for compilation with current SDCC compiler 2017-09-30 14:55:39 -06:00
Gregory Nutt 8394f9b60f Squashed commit of the following:
configs/z80sim and xtrs:  Serial driver lower halfs ioctl methods should return a negated errno value, not set the errno variable.

    drivers/wireless:  CC1101 driver not permitted to set errno.

    drivers/sensors:  LIS331DL driver not permitted to set errno.

    drivers/lcd: ILI9341 initialize method not permitted to set errno,

    drivers/serial: 16550 UART driver IOCTL method must not set errno; it must return a negated errno value.
2017-09-30 12:59:33 -06:00
Gregory Nutt c11345ad4b Squashed commit of the following:
STM32, STM32 F7:  LTDC and DMA2D drivers are not permitted to set the errno.

    SIM LPC31xx:  Serial and console drivers are not permitted to set the errno.

    SAMv7, STM32, STM32 L4:  DAC and ADC drivers are not permitted to set the errno.
2017-09-30 11:51:37 -06:00
Gregory Nutt e4dd33280d Squashed commit of the following:
psock_close() and net_close() are internal OS functions and should not set the errno variable.

    psock_ioctl() and netdev_ioctl() are internal OS functions and should not set the errno variable.

    net_dupsd() and net_dupsd2() are internal OS functions and should not set the errno variable.

    net/ and fs/: net_vfcntl(), file_fcntl(), file_dup(), and file_dup2() are all internal OS interfaces and should not modify the errno value.
2017-09-30 10:41:21 -06:00
Gregory Nutt 2c2aa94b7d Squashed commit of the following:
net/: psock_recvfrom() is an internal interface and should not set the errno nor should it be a cancellation point.

    net/: psock_accept() is not a cancellation point.

    net/: psock_getsockopt() and psock_socket*9 are an internal interfaces and should not set the errno.

    net/: psock_getsockopt() is an internal interface and should not set the errno.

    net/: psock_listen() is an internal interface and should not set the errno.

    net/: psock_connect(( is an internal interface and should not set the errno nor should it be a cancellation point.

    net/: psock_bind() is an internal interface and should not set the errno.

    net/: psock_accept() is an internal interface and should not set the errno.
2017-09-30 08:18:08 -06:00
Gregory Nutt 054b147114 net/: Versions of psock_send() and pock_sendto() should not set errno. That is taken care of at a higher level in the send()/sendto() implementation as appropriate. 2017-09-30 06:41:56 -06:00
Gregory Nutt 6c5f254a5b psock_send() no longer sets errno, so send() must now set it. 2017-09-30 06:27:37 -06:00
Mateusz Szafoni ad369a0bad Merged in raiden00/nuttx (pull request #499)
syslog_console.c: fix typo

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-09-30 12:24:37 +00:00
raiden00pl 525a180ab5 syslog_console.c: fix typo 2017-09-30 13:34:15 +02:00