Commit Graph

39046 Commits

Author SHA1 Message Date
dongjiuzhu 23ddeaf3be mm/circbuf: support circular buffer managerment
N/A

Change-Id: Ib1fc009b9ce3af5815920f22221fe8a7262299ef
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-11-20 05:33:03 -08:00
Tido Klaassen 93ff68e75a serial: Prevent RX stall
Re-check RX queue status after uart_enablerxint() and before blocking
the reading task on the receive semaphore. cdcacm (and maybe other UART
drivers) can push buffered data into the receive queue during
uart_enablerxint(), leading to a blocked task while data is already
available.

Signed-off-by: Tido Klaassen <tido@4gh.eu>
2020-11-20 04:16:35 -08:00
Masayuki Ishikawa 96c29e75b7 Update TODO regarding SMP
Summary:
- 'POSSIBLE FOR TWO CPUs TO HOLD A CRITICAL SECTION' was resolved

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-20 00:49:25 -08:00
Masayuki Ishikawa 1914aac05f arch: xtensa: Fix the pause handler for SMP
Summary:
- Apply the same logic added to cxd56_cpupause.c

Impact:
- SMP only

Testing:
- Tested with esp32-core:smp (QEMU)
- Run smp and ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-20 00:49:25 -08:00
Masayuki Ishikawa a500bd0238 arch: k210: Fix the pause handler for SMP
Summary:
- Apply the same logic added to cxd56_cpupause.c

Impact:
- SMP only

Testing:
- Tested with maix-bit:smp (QEMU)
- Run smp and ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-20 00:49:25 -08:00
Masayuki Ishikawa 42dea9edf9 arch: lc823450: Fix the pause handler for SMP
Summary:
- Apply the same logic added to cxd56_cpupause.c

Impact:
- SMP only

Testing:
- Tested with lc823450-xgevk:rndis
- Run smp and ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-20 00:49:25 -08:00
Masayuki Ishikawa 1978dcc9a9 arch: armv7-a: Fix the pause handler for SMP
Summary:
- Apply the same logic added to cxd56_cpupause.c

Impact:
- SMP only

Testing:
- Tested with sabre-6quad:smp (QEMU and dev board)
- Run smp and ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-20 00:49:25 -08:00
Masayuki Ishikawa 55c00ad3d9 arch: cxd56xx: Fix the pause handler for SMP
Summary:
- I noticed that sched_add_readytorun() runs on multiple CPUs simultaneously
- Finally, I found the root cause which was described in TODO
- Actually, the task newly scheduled on remote CPU did not acquire g_cpu_irqlock
- This commit fixes this issue by adding a critical section to the pause handler
- Which will acquire g_cpu_irqlock on the remote CPU explicitly

Impact:
- SMP only

Testing:
- Tested with spresense:wifi_smp (NCPUS=2 and 4)
- Run smp, ostest, nxplayer

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-20 00:49:25 -08:00
Brennan Ashton f48e4d5df4 Board: Add elf target for nucleo-h743zi 2020-11-20 00:42:28 -08:00
dongjiuzhu cab072b84d board/stm32f429i: support l3gd20 sensor with new sensor model
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-11-19 18:13:17 -08:00
dongjiuzhu 60d1755e04 drivers: l3gd20 supports the sensor driver model
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-11-19 18:13:17 -08:00
Brennan Ashton 9393572aea Revert "fs/nxffs: Fix scan good block slowly and scan an invalid block"
This reverts commit 97be116a39.

This commit broke nxffs.  This leaves the first block as empty which
then exposes another bug where when the pack is called because we
have reached the end of flash and need to look for deleted inodes
we search the first block find no inode and assume that there
are no more inodes.  This then results in corrupting the filesystem
by writing over existing inodes.

This can be seen by runing the sim:nxffs configuration.
Prior to this commit the first pass of writing files would look like
this:
NXFFS Dump:
  BLOCK:OFFS  TYPE  STATE   LENGTH
      0:5     INODE OK       2680
      0:78    DATA  OK        424
      1:5     DATA  OK        497
      2:5     DATA  OK        497
      3:5     DATA  OK        497
      4:5     DATA  OK        497
      5:5     DATA  OK        268
      5:283   INODE OK       7410
      5:425   DATA  OK         77
      6:5     DATA  OK        497

With this commit:
NXFFS Dump:
  BLOCK:OFFS  TYPE  STATE   LENGTH
      0:0     BLOCK ERASED    512
      1:5     INODE OK       6394
      1:39    DATA  OK        463
      2:5     DATA  OK        497
      3:5     DATA  OK        497

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-11-19 18:08:41 -08:00
Alin Jerpelea 48e6f2051d audio: libsamplerate: add initial audio Sample Rate Converter
Add audio sample rate conversion library from
http://www.mega-nerd.com/SRC/index.html

Source:
https://github.com/libsndfile/libsamplerate

Add needed patches for NuttX OS and embedded boards.

NOTE:
We must use master branch until next stable release
2020-11-19 18:05:47 -08:00
YAMAMOTO Takashi f1aab27c92 include/nuttx/streams.h: Sprinkle scanflike 2020-11-19 18:03:04 -08:00
YAMAMOTO Takashi b90809d5f0 stdio.h: Sprinkle scanflike 2020-11-19 18:03:04 -08:00
YAMAMOTO Takashi d167ec6038 compiler.h: Add scanflike macro 2020-11-19 18:03:04 -08:00
YAMAMOTO Takashi 1f6d54fde4 include/nuttx/streams.h: Add printflike 2020-11-19 18:03:04 -08:00
YAMAMOTO Takashi 7e702817c1 stdio.h: Sprinkle printflike attribute 2020-11-19 18:03:04 -08:00
YAMAMOTO Takashi eb406a8394 compiler.h: Add printflike macro
The name was inspired from NetBSD's __printflike.

We can add similar macros for __syslog__, __scanf__, __format_arg__
later.
2020-11-19 18:03:04 -08:00
Masayuki Ishikawa fe8026d952 boards: sabre-6quad: Fix README.txt
Summary:
- Remove comments on up_idle() which is old information
- Add L2CC info with QEMU

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-19 18:01:30 -08:00
Masayuki Ishikawa 12862c7b33 armv7-a: Fix comments on Cortex-A SGI
Summary:
- I noticed that Cortex-A SGI can be masked
- We thought the SGI is not maskable
- Although I can not remember how I tested it before
- It actually works as expected now
- Also, fixed the number of remaining bugs in TODO

Impact:
- No impact

Testing:
- Tested with sabre-6quad:smp (QEMU and dev board)
- Add the following code in up_idle() before calling asm("WFI");
+  if (0 != up_cpu_index())
+    {
+      up_irq_save();
+    }
- Run the hello app, you can see "Hello, World!!"
- But nsh will freeze soon because arm_pause_handler is not called.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-19 18:01:30 -08:00
Juha Niskanen 23495a7fa2 drivers/mtd/mtd_progmem.c: fix progmem_log2 parameter type to match prototype
If size_t != uint32_t, this can give a build error:

 mtd/mtd_progmem.c:134:16: error: conflicting types for 'progmem_log2'
   134 | static int32_t progmem_log2(uint32_t blocksize)
       |                ^~~~~~~~~~~~
 mtd/mtd_progmem.c:82:16: note: previous declaration of 'progmem_log2' was here
    82 | static int32_t progmem_log2(size_t blocksize);
       |                ^~~~~~~~~~~~
 Makefile:118: recipe for target 'mtd_progmem.o' failed

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-11-19 07:43:07 -08:00
Abdelatif Guettouche 79b07e6c94 arch/xtensa/src/esp32/esp32_gpio.c: Fix GPIO IRQ assert condition.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2020-11-19 07:38:59 -08:00
YAMAMOTO Takashi 6ee7fdf874 include/inttypes.h: Provide PRIdMAX and friends using 'j' modifier
Replace definitions in other places.
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 123d882027 sim types.h: A workaround for macOS MODULECC 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi a863fa30f9 sim: Make int64_t match the host OS 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi c97f6f1b59 sim: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 09fca224ec arch/sim/include/inttypes.h: Fix intptr_t
64-bit size_t/intptr_t/ptrdiff_t are long, not long long,
for macOS and Linux.

Note: we don't care CONFIG_SIM_M32 on macOS.

macOS:
    spacetanuki% uname -a
    Darwin spacetanuki.lan 18.7.0 Darwin Kernel Version 18.7.0: Mon Aug 31 20:53:32 PDT 2020; root:xnu-4903.278.44~1/RELEASE_X86_64 x86_64
    spacetanuki% cc --version
    Apple clang version 11.0.0 (clang-1100.0.33.17)
    Target: x86_64-apple-darwin18.7.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    spacetanuki% cc -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    spacetanuki% cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    spacetanuki%

Linux:
    root@4c2e9e83ac82:/tools# uname -a
    Linux 4c2e9e83ac82 5.4.39-linuxkit #1 SMP Fri May 8 23:03:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    root@4c2e9e83ac82:/tools# cc --version
    cc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    root@4c2e9e83ac82:/tools# cc -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    root@4c2e9e83ac82:/tools# cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ unsigned int
    root@4c2e9e83ac82:/tools#
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi fca3b63800 mips: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi a0ed2b64c9 mips: Use types matching the compiler types
root@212cf3f52994:/tools# p32-gcc -mlong32 -dM -E - < /dev/null | grep "__INT.*_TYPE__"|sort
    #define __INT16_TYPE__ short int
    #define __INT32_TYPE__ long int
    #define __INT64_TYPE__ long long int
    #define __INT8_TYPE__ signed char
    #define __INTMAX_TYPE__ long long int
    #define __INTPTR_TYPE__ int
    #define __INT_FAST16_TYPE__ int
    #define __INT_FAST32_TYPE__ int
    #define __INT_FAST64_TYPE__ long long int
    #define __INT_FAST8_TYPE__ int
    #define __INT_LEAST16_TYPE__ short int
    #define __INT_LEAST32_TYPE__ long int
    #define __INT_LEAST64_TYPE__ long long int
    #define __INT_LEAST8_TYPE__ signed char
    root@212cf3f52994:/tools#
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 152a6e67ea hcs12: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi e33f5c1c6a hc12: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 27352716fd z16: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 8a54cca442 ez80: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 173916dcdc z80: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi be94340adb z8: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 2cda13b642 z180: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 5995cfc2ce or1k: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 7d45dc3e6a misoc: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi ff9ee6902e m16c: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 54a0037981 sh1: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 7890fc6f59 rx65n: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 6ee85aef07 rx65n: Fix int32_t to match the compiler
root@212cf3f52994:/tools# rx-elf-gcc -dM -E - < /dev/null | grep "__INT.*_TYPE__"|sort
    #define __INT16_TYPE__ short int
    #define __INT32_TYPE__ long int
    #define __INT64_TYPE__ long long int
    #define __INT8_TYPE__ signed char
    #define __INTMAX_TYPE__ long long int
    #define __INTPTR_TYPE__ long int
    #define __INT_FAST16_TYPE__ int
    #define __INT_FAST32_TYPE__ int
    #define __INT_FAST64_TYPE__ long long int
    #define __INT_FAST8_TYPE__ int
    #define __INT_LEAST16_TYPE__ short int
    #define __INT_LEAST32_TYPE__ long int
    #define __INT_LEAST64_TYPE__ long long int
    #define __INT_LEAST8_TYPE__ signed char
    root@212cf3f52994:/tools#
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 1f20f83fa0 i486: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi a462644e32 intel64: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 7eef194a93 intel64: Switch int64_t from long long to long
To make it match what the compiler expects.

on nuttx-ci-linux image:
    root@fec5a6192c70:/tools# gcc -dM -E - < /dev/null | grep -E "UINT(32|64)_TYPE"
    #define __UINT64_TYPE__ long unsigned int
    #define __UINT32_TYPE__ unsigned int
    root@fec5a6192c70:/tools#

on macOS:
    spacetanuki% x86_64-elf-gcc -dM -E - < /dev/null | grep -E "UINT(32|64)_TYPE"
    #define __UINT32_TYPE__ unsigned int
    #define __UINT64_TYPE__ long unsigned int
    spacetanuki%
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi cce626b545 risc-v: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi e99321bf9d risc-v 32-bit: Fix types to match what the compiler expects
spacetanuki% riscv64-unknown-elf-gcc -march=rv32im -mabi=ilp32 -dM -E - < /dev/null | grep INT32_TYPE
    #define __INT32_TYPE__ long int
    #define __UINT32_TYPE__ long unsigned int
    spacetanuki% riscv64-unknown-elf-gcc -march=rv32im -mabi=ilp32 -dM -E - < /dev/null | grep INT64_TYPE
    #define __INT64_TYPE__ long long int
    #define __UINT64_TYPE__ long long unsigned int
    spacetanuki% riscv64-unknown-elf-gcc -dM -E - < /dev/null | grep LP64
    #define __LP64__ 1
    #define _LP64 1
    spacetanuki%
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 723cc14009 risc-v: Switch int64_t from long long to long
So that it matches what the toolchain expects.

    spacetanuki% riscv64-unknown-elf-gcc --version
    riscv64-unknown-elf-gcc (SiFive GCC 8.3.0-2019.08.0) 8.3.0
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    spacetanuki% riscv64-unknown-elf-gcc -dM -E - < /dev/null | grep UINT64_TYPE
    #define __UINT64_TYPE__ long unsigned int
    spacetanuki%
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 9c1d235329 avr: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00