Commit Graph

38880 Commits

Author SHA1 Message Date
Matias N
f55a2879ca nrf52 GPIO/GPIOTE: better expose pin interrupt capability
This change improves upon current support for pin interrupts. Before,
a pin interrupt was handled (with nrf52_gpiote_setevent) using one
of the eight available GPIOTE channels. Moreover, it didn't event let
the user specify which channel to use (simply tried to get a free one).
Also, it was buggy since it did not consider unsetting the callback.

Besides GPIOTE channels, there is another way to deal with pin interrupts.
The GPIO peripheral is capable of generating a PORT event
(for the whole GPIO port) depending on the pin SENSE configuration
(HIGH or LOW, or NONE) and GPIO DETECTMODE register
(latching or non-latching).

This change then renames nrf52_gpiote_setevent into nrf52_gpiote_set_ch_event,
maintaining functionality of original function, but now allows specifying
channel (and correctly handles unsetting the callback). Then, a
new nrf52_gpiote_set_pin_event is added, which allows to set a callback
for a given pin. During initialization, interrupt for the PORT event is
enabled and handled in such way that for each pin whose corresponding
bit in LATCH register (indicates the result of pin SENSEing) the
callback for this pin will be invoked. This mechanism means that
every pin can get an ISR. It also avoids using GPIOTE channels for this
purpose which carry higher current consumption.

This new per-pin callback mechanism has some added memory requirement
so it can be disabled and its default is dependant on DEFAULT_SMALL.
When disabled, a callback for the PORT event can be set directly
with nrf52_gpiote_set_port_event

There was only one use of nrf52_gpio_setevent() which was migrated
into nrf52_gpio_set_ch_event() passing channel zero.
2020-11-09 20:23:29 +01:00
chao.an
723698c787 sched/timer: add support of CLOCK_MONOTONIC
Reference here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/timer_create.html

DESCRIPTION
...
  Each implementation shall define a set of clocks that can be
  used as timing bases for per-process timers. All implementations
  shall support a clock_id of CLOCK_REALTIME.

  *** If the Monotonic Clock option is supported, implementations shall
  support a clock_id of CLOCK_MONOTONIC. ***
...

Change-Id: Ia8e7302ed4a7e9ec11a0059bd68e9674ea942001
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 15:01:36 -03:00
raiden00pl
728c3fc409 nrf52840-dk: add sx127x example configuration 2020-11-09 08:07:13 -08:00
Sara Souza
8a1960fdf4 Documentation for Watchdog Timer Driver 2020-11-09 08:06:10 -08:00
chao.an
8604e98196 unistd/sched_sporadic: correct the disable value
Reference here:
https://github.com/openbsd/src/blob/master/include/unistd.h

Change-Id: Ifb08a69c9a2a2b68179bcfd716fb180ec3577e54
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 09:11:51 -03:00
chao.an
182507f325 boards/sim: add atexit(2) into naming list
(gdb) b longjmp
Breakpoint 1 at 0x8270
(gdb) r
Starting program: /home/chao/code/m3/nuttx/nuttx
[    0.000000] Assertion failed at file:task/task_onexit.c line: 99

Breakpoint 1, 0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
(gdb)
(gdb) bt
|#0  0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
|#1  0xf7f9c3dc in siglongjmp_alias () from /lib/i386-linux-gnu/libpthread.so.0
|#2  0x5655d668 in up_assert (filename=0x56641018 "task/task_onexit.c", line=99) at sim/up_head.c:132
|#3  0x56567413 in _assert (filename=0x56641018 "task/task_onexit.c", linenum=99) at assert/lib_assert.c:36
|#4  0x565f8cfd in on_exit (func=0x565f8c12 <exitfunc>, arg=0x565fd780 <simuart_restoremode>) at task/task_onexit.c:99
|#5  0x565f8c89 in atexit (func=0x565fd780 <simuart_restoremode>) at task/task_atexit.c:109
|#6  0x565fd819 in simuart_start () at sim/up_simuart.c:112
|#7  0x5656c844 in up_uartinit () at sim/up_uart.c:496
|#8  0x5656ba7a in up_initialize () at sim/up_initialize.c:234
|#9  0x5655da56 in nx_start () at init/nx_start.c:701
|#10 0x5655d5e9 in main (argc=1, argv=0xffffd6f4, envp=0xffffd6fc) at sim/up_head.c:96

Change-Id: Ifd7196b2de7bf9fc7cea764c19a5c0eacf08fdb6
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 09:08:03 -03:00
chao.an
54d0c1c296 sys/uio: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:33:52 -08:00
chao.an
176d850445 sys/uio: include-able from C++ files
Change-Id: I4b512851fa96e1d696dbc886b25af4ab043da8dd
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:33:52 -08:00
chao.an
06d93828af sys/resource: fix nxstyle warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:22:34 -08:00
chao.an
82f1263db9 sys/resource: include-able from C++ files
Change-Id: I914ab40495a25da184d0b7f8f8b1fa0d376c66a4
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 02:22:34 -08:00
Masayuki Ishikawa
2395ab7f6e sched: task: Fix nxtask_exit() for SMP
Summary:
- I noticed that nxsched_merge_pending() is called outside a critical section
- The issue happens if a new rtcb does not hold a critical section
- Actually, global IRQ control is done in nxsched_resume_scheduler() in nxtask_exit()
- However, nxsched_merge_pending() was called after calling nxsched_resume_scheduler()
- This commit fixes the issue by moving nxsched_merge_pending() before the function
- NOTE: the sequence was changed for SMP but works for non-SMP as well

Impact:
- This commit affects both SMP and non-SMP

Testing:
- Tested with ostest with the following configurations
- spresense:wifi_smp (NCPUS=2 and 4)
- spresense:wifi (non SMP)
- sabre-6quad:smp (QEMU)
- esp32-core:smp (QEMU)
- maix-bit:smp (QEMU)
- sim:smp
- lc823450-xgevk:rndis

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-09 10:59:20 +01:00
Brennan Ashton
5d872e09e6 Remove depricated usage of set-env in GitHub
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-11-08 19:38:59 -08:00
Nathan Hartman
8e00110449 tiva/cc13x2_cc26x2: Merge related comments
arch/arm/src/tiva/hardware/cc13x2_cc26x2/cc13x2_cc26x2_flash.h:

    * Merge comments when they are section separators for
      similar/related registers:

      - TIVA_FLASH_FWPWRITE*
      - TIVA_FLASH_FSM_SECTOR1*
      - TIVA_FLASH_FSM_BSLE*
      - TIVA_FLASH_FSM_BSLP*
2020-11-08 13:39:56 -08:00
Juha Niskanen
5849d88288 boards/sim/sim/sim/src/sim_touchscreen.c: add missing nx_disconnect
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-11-08 15:25:10 -03:00
Juha Niskanen
ca7a7ccbeb Fix some typos in comments
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-11-08 18:58:20 +01:00
Juha Niskanen
70cbb7e537 include/nuttx/net/netconfig.h: fix typos and nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-11-08 18:58:20 +01:00
Juha Niskanen
62d38c32e8 drivers/lcd/memlcd.c: fix typos and nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-11-08 18:58:20 +01:00
Nathan Hartman
350309856d tiva/cc13x2_cc26x2: Fix nxstyle errors
arch/arm/src/tiva/hardware/cc13x2_cc26x2/cc13x2_cc26x2_flash.h:

    * Fix nxstyle errors.
2020-11-08 18:56:55 +01:00
Sara Souza
b9d44017cf xtensa/esp32: Watchdog support (MWDTs) 2020-11-08 13:05:24 -03:00
Xiang Xiao
b23bca5cb3 libcxx: Update 0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch
All changes come from:
from YAMAMOTO Takashi <yamamoto@midokura.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-08 13:04:43 -03:00
Brennan Ashton
ab176cf1d3 sim: Enable required CONFIG_SIM_FRAMEBUFFER 2020-11-07 22:59:42 -08:00
Brennan Ashton
05dc66ed29 Fix issue #2098 non functional sim:touchscreen
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-11-07 22:59:42 -08:00
Alan C. Assis
816af60b77 xtensa/esp32: Include cache workaround to PSRAM 2020-11-07 12:08:02 +01:00
Yoshinori Sugino
878dc33736 sched/task/task_exithook.c: Remove a redundant assignment 2020-11-07 11:14:43 +01:00
Subhra Sankha Sarkar
6d32ad04dd Minor fixes & NuttX coding standards compliance 2020-11-07 06:41:40 -03:00
Nathan Hartman
94a10033e0 tiva/cc13x2_cc26x2: Fix nxstyle errors
arch/arm/src/tiva/hardware/cc13x2_cc26x2/cc13x2_cc26x2_fcfg1.h:

    * Fix nxstyle errors.
2020-11-06 20:47:01 -03:00
Abdelatif Guettouche
f052a9b1e6 baords/xtensa/esp32/esp32-core: Update all configs to add the new region
of memory.
2020-11-06 18:36:41 -03:00
Abdelatif Guettouche
2ac2ce55d2 arch/xtensa/src/esp32/esp32_allocateheap.c: Fix the memory regions with
regards to the data used by the ROM.
Static alloaction sections should end at the begining of the ROM data.
The rest of memory (End of ROM data --> End of DRAM) is added to the
heap.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2020-11-06 18:36:41 -03:00
Nicholas Chin
c7a9b66833 arch/arm/src/imxrt: adds support for WDOG1
Based on work done by Jake Choy.
2020-11-06 18:33:34 -03:00
Daniel P. Carvalho
a5d340a5df Add injected channel support. 2020-11-06 18:31:32 -03:00
Abdelatif Guettouche
5adcdcdc15 arch/arm/src/stm32l4/stm32l4_can.c: Fix nxstyle issues. 2020-11-06 18:28:27 -03:00
Pavel Pisa
be1496b40d stm32l4: correct build of stm32l4_can.c to respect L4 variant.
Signed-off-by: Pavel Pisa<ppisa@pikron.com>
2020-11-06 18:28:27 -03:00
Alan C. Assis
2f612a2077 xtensa/esp32: Move #if defined(SPIRAM) to inside function 2020-11-06 16:19:48 +01:00
Alan C. Assis
d11f02d772 xtensa/esp32: Fix remaining SEPARATE typo 2020-11-06 16:19:48 +01:00
Alan C. Assis
6c37d9ff80 xtensa/esp32: Avoid init PSRAM when SPIRAM is not enabled 2020-11-06 16:19:48 +01:00
Yoshinori Sugino
d3700649c0 sched/sched/sched_waitid.c: Allow WNOHANG
In the current implementation of waitid, WEXITED is mandatory and WNOHANG is optional.
2020-11-06 00:44:55 -08:00
Yoshinori Sugino
51875ab039 sched/sched/sched_waitpid.c: Fix a typo 2020-11-05 23:06:51 -08:00
YAMAMOTO Takashi
713a21e57c or1k inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
6062b9f7fc z180 inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
13f469304c z80 inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
509a190be2 i486 inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
c8f3abd910 misoc inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
f752b360f6 risc-v inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
4b382c6bab intel64 inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
64280ad7d9 sh1 inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
178815ea34 arm inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
1d4610060d rx65n inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
7c642466c6 z16 inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
6bc93b87b0 xtensa inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
093662bc99 z8 inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00