Gregory Nutt <gnutt@nuttx.org>
Run all .c and .h files modified in this PR through nxstyle and correct all coding standard problems.
Xiang Xiao <xiaoxiang@xiaomi.com>
Remove TIME_EXTENDED option to more conform C standard
Note: the code/data size increment is small
* Simplify EINTR/ECANCEL error handling
1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx
* Unify the void cast usage
1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
Ran nxstyle against many of the affected files. But this job was too big for today. Many of the network drivers under arch are highly non-compiant and generate many, many faults from nxstyle. Those will have to be visited again another day.
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
This effects all network drivers as well as timing related portions of net/: devif_poll_tcp_timer shouldn't be skipped in the multiple card case. devif_timer will be called multiple time in one period if the multiple card exist, the elapsed time calculated for the first callback is right, but the flowing callback in the same period is wrong(very short) because the global variable g_polltimer is used in the calculation. So let's pass the delay time to devif_timer and remove g_polltimer.
Move boards to boards folder
* boards: rename configs folder to boards
This is the proposed layout after the change:
boards: - folder containing board folders
<board>: - name of each board
drivers: - extra drivers specific for platform
include: - header files for the boars
scripts: - extra scripts specific for platform
src: - board specific code
tools: - extra tools specific for platform
<config>: - board specific configuration(s)
Note:
<xxx> names are dependent on platform
This is a logical change to aim to the arch layout but this is a
huge change it should be done in several steps to lower the risk.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* Kconfig: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* Makefile: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* Makefile.*: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* Make.defs: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* .sh: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* .mk: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* .c & .h: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* .bat: replace configs with boards
The change is needed after the path change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
Squashed commit of the following:
configs/makerlisp/scripts/makerlisp_ram.linkcmd: Fixup .RESET and .STARTUP. These need to be redirected to RAM since they default to ROM.
configs/makerlisp/scripts/makerlisp_ram.linkcmd: Restore some settings that should be unnecessary but are really required by the current implementation.
configs/makerlisp: Rename nsh configuratinon to nsh_flash. Create new configuration, nsh_ram, that is identical to the nsh_flash configuration except that the code runs out of external SRAM.
configs/makerlisp/scripts: Add a linker script to support execution from RAM.
commit f5080f53516a853408dd80f09f85e1d1c139133f
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 12:24:22 2019 -0600
arch/z80/src/ez80/ez80_spi.c: SPI driver still does not work. But the driver now has timeouts so that at least it does not hang the system on startup.
commit 5241e9ae643981c43c8c7fa8478a01d0c2e17eb0
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 10:45:11 2019 -0600
arch/z80/src/ez80: Fixes to SPI baud rate calculation.
commit ce2e9e3703485563a0a5b6a57e4080ad45d91fd7
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 09:29:13 2019 -0600
arch/z80/src/ez80: Cosmetic and unnecessary clean-up or serial driver.
commit 77287c8508a7e3262068d3e8cf1c5f8e27f3a144
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 09:08:56 2019 -0600
arch/z80/src/common and arch/z80/src/ez80: Clean up some assertion-related logic.
commit 4d2d3594c22f7240119255825fce2d2437301404
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 07:48:21 2019 -0600
configs/makerlisp/nsh/defconfig: Enable STACKDUMP on assertion.
commit 76b7a2faa3f213dd26634dd9440d12f746cac097
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 07:47:55 2019 -0600
configs/makerlisp/include/board.h: Don't put the board in reset on a simple assertion, onlhy a full panic.
commit 0a0dc12edcd39c07696769cb7249d8c39a148ccc
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 07:46:54 2019 -0600
arch/z80/src/ez80/ez80_rtc_lowerhalf.c: Remove all references to alarm ID.
commit 1a4dba1075fcf6466e87520a8ba66bbf91d696d7
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 07:33:29 2019 -0600
configs/makerlisp/src/ez80_bringup.c: Fix an error that was causing MMC/SD to fail to initialize. Unfortunately now the system hangs.
commit 145a395c7a8e73336fe62caf803d108c59e306a5
Author: Gregory Nutt <gnutt@nuttx.org>
Date: Mon Jun 17 07:32:50 2019 -0600
arch/z80/src/ez80: Add an RTC lower half driver. Initial commit is just the STM32 RTC lower half with name changes.
nuttx/arch/z80/src: To properly follow the coding standard, the z80 architecture common should up_mmuinit should be called z80_mmu_initialize.
nuttx/arch/z80/src: To properly follow the coding standard, the z80 architecture common should up_loweserialinit should be called z80_lowserial_initialize.
configs/z80sim/src/z80_serial.c: Remove unused function up_earlyserialinit()
nuttx/arch/z80/src: To properly follow the coding standard, the z80 architecture common should up_serialinit should be called z80_serial_initialize.
nuttx/arch/z80/src: To properly follow the coding standard, the z80 architecture common should up_doirq should be called z80_doirq.
arch/z80/src/common: up_addregion() must be prototyped in nuttx/mm/mm.h, not up_internal.h
arch/z80/src/ez80: Clean-up RTC driver; get a clean compilation. Still untested.
arch/z80/src/ez80: This brings the RTC to code complete, but does not yet compile.
arch/z80/src/ez80/ez80_rtc.c: Bring in badly ported RTC driver from STM32F4. Little more than naming changing at this point not even ready to attempt comilation
arch/z80/src/ez80: Add RTC driver. Initial commit is just the STMF4 RTC driver with name changes.
configs/makerlisp/src/ez80_spi.c: Add hooks needed by SPI driver. Move SPI MMC/SD chip selected configuration from ez80_lowinit.c to here as it done in other NuttX architectures. This enables support for multiple devices on the SPI bus.
Squashed commit of the following:
configs/makerlisp: Update comments about use of serial console.
configs/makerlisp: Add LED support, remove vestiges of button support (the board has no user buttons). Add support for SPI-based MMC/SD card slot.
arch/z80/src/ez80: Fix some link problems.
libs/libc/syslog/lib_syslog.c: The ZDS-II toolchain does not declare va_coy in stdarg.h. I think that the use of va_copy in vsyslog() is no necessary.
configs/makerlisp: Initial configuration directories cloned from ez80f910200zco with little more than naming changes.
ez80: Fixing a few more compile problems. I am afraid that the 5.3.0 compiler it too buggy to use.
ez80: Additional build-related fixed.
eZ80: Updating to use the newest ZDSII 5.3.0 toolchain.
libs/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
syscall/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
wireless/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
Documentation/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
include/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
drivers/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
sched/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
configs: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
arch/xtensa: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
arch/z80: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
arch/x86: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
arch/renesas and arch/risc-v: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
arch/or1k: Remove all references to CONFIG_DISABLE_SIGNALS. Signals are always enabled.
arch/misoc: Remove all references to CONFIG_DISABLE_SIGNALS. Signals are always enabled.
arch/mips: Remove all references to CONFIG_DISABLE_SIGNALS. Signals are always enabled.
arch/avr: Remove all references to CONFIG_DISABLE_SIGNALS. Signals are always enabled.
arch/arm: Remove all references to CONFIG_DISABLE_SIGNALS. Signals are always enabled.
Squashed commit of the following:
configs/: The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
fs/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
tools/: Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
syscall/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
libs/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
include/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
drivers/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
Documentation/: Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
binfmt/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
arch/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
net/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
sched/: Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
sched/Kconfig: CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
configs/: Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
sched/init/nx_bringup.c: Fix a naming collision.
sched/init: Rename os_start() to nx_start()
sched/init: Rename os_smp* to nx_smp*
sched/init: Rename os_bringup to nx_bringup
sched/init: rename all internal static functions to begin with nx_ vs os_
Squashed commit of the following:
Trivial, cosmetic
sched/, arch/, and include: Rename task_vforkstart() as nxtask_vforkstart()
sched/, arch/, and include: Rename task_vforkabort() as nxtask_vforkabort()
sched/, arch/, and include: Rename task_vforksetup() as nxtask_vfork_setup()
sched/: Rename notify_cancellation() as nxnotify_cancellation()
sched/: Rename task_recover() to nxtask_recover()
sched/task, sched/pthread/, Documentation/: Rename task_argsetup() and task_terminate() to nxtask_argsetup() and nxtask_terminate(), respectively.
sched/task: Rename task_schedsetup() to nxtask_schedsetup()
sched/ (plus some binfmt/, include/, and arch/): Rename task_start() and task_starthook() to nxtask_start() and nxtask_starthook().
arch/ and sched/: Rename task_exit() and task_exithook() to nxtask_exit() and nxtask_exithook(), respectively.
sched/task: Rename all internal, static, functions to begin with the nx prefix.
This makes the user interface a little hostile. People thing of an MTU of 1500 bytes, but the corresponding packet is really 1514 bytes (including the 14 byte Ethernet header). A more friendly solution would configure the MTU (as before), but then derive the packet buffer size by adding the MAC header length. Instead, we define the packet buffer size then derive the MTU.
The MTU is not common currency in networking. On the wire, the only real issue is the MSS which is derived from MTU by subtracting the IP header and TCP header sizes (for the case of TCP). Now it is derived for the PKTSIZE by subtracting the IP header, the TCP header, and the MAC header sizes. So we should be all good and without the recurring 14 byte error in MTU's and MSS's.
Squashed commit of the following:
Trivial update to fix some spacing issues.
net/: Rename several macros containing _MTU to _PKTSIZE.
net/: Rename CONFIG_NET_SLIP_MTU to CONFIG_NET_SLIP_PKTSIZE and similarly for CONFIG_NET_TUN_MTU. These are not the MTU which does not include the size of the link layer header. These are the full size of the packet buffer memory (minus any GUARD bytes).
net/: Rename CONFIG_NET_6LOWPAN_MTU to CONFIG_NET_6LOWPAN_PKTSIZE and similarly for CONFIG_NET_TUN_MTU. These are not the MTU which does not include the size of the link layer header. These are the full size of the packet buffer memory (minus any GUARD bytes).
net/: Rename CONFIG_NET_ETH_MTU to CONFIG_NET_ETH_PKTSIZE. This is not the MTU which does not include the size of the link layer header. This is the full size of the packet buffer memory (minus any GUARD bytes).
net/: Rename the file d_mtu in the network driver structure to d_pktsize. That value saved there is not the MTU. The packetsize is the memory large enough to hold the maximum packet PLUS the size of the link layer header. The MTU does not include the link layer header.
Signal handlers maybe run with interrupts enabled or disabled, depending on how the task the received the signal was blocked. (i.e.: If sem_wait() is called, then we disable interrupts, then block the currently running task). This could be dangerous, because user code would be running with interrupts disabled.
This change forces interrupts to be enabled in up_sigdeliver() before executing the signal handler calling up_irq_enable() explicitly. This is safe because, when we return to normal execution, interrupts will be restored to their previous state when the signal handler returns.
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.
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
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.
Provide a user defined callback context for irq's, such that when
registering a callback users can provide a pointer that will get
passed back when the isr is called.