Commit Graph

19999 Commits

Author SHA1 Message Date
David Sidrane
da7fe760e8 s32k1xx:LPI2C Add DMA support
s32k3xx:LPI2C fix RESET so it compiles
2022-12-03 13:54:34 +08:00
chao an
34d2cde8a8 net/l2/l3/l4: add support of iob offload
1. Add new config CONFIG_NET_LL_GUARDSIZE to isolation of l2 stack,
   which will benefit l3(IP) layer for multi-MAC(l2) implementation,
   especially in some NICs such as celluler net driver.

new configuration options: CONFIG_NET_LL_GUARDSIZE

CONFIG_NET_LL_GUARDSIZE will reserved l2 buffer header size of
network buffer to isolate the L2/L3 (MAC/IP) data on network layer,
which will be beneficial to L3 network layer protocol transparent
transmission and forwarding

------------------------------------------------------------
Layout of frist iob entry:

        iob_data (aligned by CONFIG_IOB_ALIGNMENT)
            |
            |                  io_offset(CONFIG_NET_LL_GUARDSIZE)
            |                                |
            -------------------------------------------------
      iob   |            Reserved            |    io_len    |
            -------------------------------------------------

-------------------------------------------------------------
Layout of different NICs implementation:

        iob_data (aligned by CONFIG_IOB_ALIGNMENT)
            |
            |                 io_offset(CONFIG_NET_LL_GUARDSIZE)
            |                                |
            -------------------------------------------------
 Ethernet   |       Reserved    | ETH_HDRLEN |    io_len    |
            ---------------------------------|---------------
 8021Q      |   Reserved  | ETH_8021Q_HDRLEN |    io_len    |
            ---------------------------------|---------------
 ipforward  |            Reserved            |    io_len    |
            -------------------------------------------------

--------------------------------------------------------------------

2. Support iob offload to l2 driver to avoid unnecessary memory copy

Support send/receive iob vectors directly between the NICs and l3/l4
stack to avoid unnecessary memory copies, especially on hardware that
supports Scatter/gather, which can greatly improve performance.

new interface to support iob offload:

  ------------------------------------------
  |    IOB version     |     original      |
  |----------------------------------------|
  |  devif_iob_poll()  |   devif_poll()    |
  |       ...          |       ...         |
  ------------------------------------------

--------------------------------------------------------------------

1> NIC hardware support Scatter/gather transfer

TX:

                tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
                           /              \
                          /                \
devif_poll_[l3|l4]_connections()     devif_iob_send() (nocopy:udp/icmp/...)
           /                                   \      (copy:tcp)
          /                                     \
  devif_iob_poll("NIC"_txpoll)                callback() // "NIC"_txpoll
                                                  |
                            dev->d_iob:           |
                                                ---------------         ---------------
                             io_data       iob1 |  |          |    iob3 |  |          |
                                    \           ---------------         ---------------
                                  ---------------  |       --------------- |
                             iob0 |  |          |  |  iob2 |  |          | |
                                  ---------------  |       --------------- |
                                     \             |          /           /
                                        \          |       /           /
                                   ----------------------------------------------
                    NICs io vector |    |    |    |    |    |    |    |    |    |
                                   ----------------------------------------------

RX:

  [tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
                    |
                    |
      [tcp|udp|icmp|...]_ipv[4|6]_in()/...
                    |
                    |
          pkt/ipv[4/6]_input()/...
                    |
                    |
     NICs io vector receive(iov_base to each iobs)

--------------------------------------------------------------------

2> CONFIG_IOB_BUFSIZE is greater than MTU:

TX:

"(CONFIG_IOB_BUFSIZE) > (MAX_NETDEV_PKTSIZE + CONFIG_NET_GUARDSIZE + CONFIG_NET_LL_GUARDSIZE)"

                tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
                           /              \
                          /                \
devif_poll_[l3|l4]_connections()     devif_iob_send() (nocopy:udp/icmp/...)
           /                                   \      (copy:tcp)
          /                                     \
  devif_iob_poll("NIC"_txpoll)                callback() // "NIC"_txpoll
                                                  |
                                             "NIC"_send()
                          (dev->d_iob->io_data[CONFIG_NET_LL_GUARDSIZE - NET_LL_HDRLEN(dev)])

RX:

  [tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
                    |
                    |
      [tcp|udp|icmp|...]_ipv[4|6]_in()/...
                    |
                    |
          pkt/ipv[4/6]_input()/...
                    |
                    |
     NICs io vector receive(iov_base to io_data)

--------------------------------------------------------------------

3> Compatible with all old flat buffer NICs

TX:
                tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
                           /              \
                          /                \
devif_poll_[l3|l4]_connections()     devif_iob_send() (nocopy:udp/icmp/...)
           /                                   \      (copy:tcp)
          /                                     \
  devif_iob_poll(devif_poll_callback())  devif_poll_callback() /* new interface, gather iobs to flat buffer */
       /                                           \
      /                                             \
 devif_poll("NIC"_txpoll)                     "NIC"_send()(dev->d_buf)

RX:

  [tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
                    |
                    |
      [tcp|udp|icmp|...]_ipv[4|6]_in()/...
                    |
                    |
               netdev_input()  /* new interface, Scatter/gather flat/iob buffer */
                    |
                    |
          pkt/ipv[4|6]_input()/...
                    |
                    |
    NICs io vector receive(Orignal flat buffer)

3. Iperf passthrough on NuttX simulator:

  -------------------------------------------------
  |  Protocol      | Server | Client |            |
  |-----------------------------------------------|
  |  TCP           |  813   |   834  |  Mbits/sec |
  |  TCP(Offload)  | 1720   |  1100  |  Mbits/sec |
  |  UDP           |   22   |   757  |  Mbits/sec |
  |  UDP(Offload)  |   25   |  1250  |  Mbits/sec |
  -------------------------------------------------

Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-03 11:47:04 +08:00
David Sidrane
ddc178122e s32k3xx:EDMA Add Error handeling 2022-12-03 02:47:42 +08:00
David Sidrane
1d84656f79 s32k3xx:EDMA Add Looping and Cleanup 2022-12-03 02:47:42 +08:00
David Sidrane
22390df92d s32k3xx:EDMA fix DMAMUX1 access violation 2022-12-02 22:56:07 +08:00
qiaohaijiao1
18bca596d4 sim/sim_alsa.c: add mp3 offload playback on sim
use host libmad to simulate read DSP.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2022-12-02 22:55:38 +08:00
chao an
c1c17794f9 arm/arm: generating assemble code in ARM states by default
The following changes omit the arm version:

| commit d321080351
| Author: chao an <anchao@xiaomi.com>
| Date:   Fri Dec 2 02:52:18 2022 +0800
|
|     arm/cortex-[a|r]: generating assemble code in ARM states by default
|
|     Signed-off-by: chao an <anchao@xiaomi.com>

Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-02 13:54:17 +08:00
TimJTi
b6c148e763 Style changes for sam_adc.c and sam_tsd.c 2022-12-02 01:09:25 +01:00
chao an
77aede7c87 arm/thumb: outputs an implicit IT block to avoid build break
Fix build break on thumb2 mode:
opus/celt/arm/celt_pitch_xcorr_arm-gnu.S: Assembler messages:
opus/celt/arm/celt_pitch_xcorr_arm-gnu.S:146: Error: thumb conditional instruction should be in IT block -- `movle pc,lr'

Reference:
https://developer.arm.com/documentation/100067/0612/armclang-Command-line-Options/-mimplicit-it

In A32 code, the integrated assembler accepts all conditional instructions
without giving an error or warning. In T32 code, the integrated assembler
outputs an implicit IT block when there is a conditional instruction
without an enclosing IT block. The integrated assembler does not give an
error or warning about this.

Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-01 22:14:34 +01:00
chao an
9ab97df0a5 arm/cortex-[a|r]/thumb: force assembler files to be interpreted as Thumb code
The option '-mthumb' is only valid for C source files and it is not passed to the assembler.

If 'thumb' is not considered in some assembly projects, the system will generate
'undefined instructions' when running incompatible instruction:

arm_undefinedinsn: Undefined instruction at 0x380cfc98

This assembly file should be compiled with .thumb but it doesn't:

380cfc90 <hobot_i8_i32_gemm_nn_m4_n8_neon>:
380cfc90: e92d4ff0  push  {r4, r5, r6, r7, r8, r9, sl, fp, lr}
380cfc94: ed2d8b10  vpush {d8-d15}
380cfc98: e59d4064  ldr r4, [sp, #100]  ; 0x64   <-- Undefined instruction
380cfc9c: e59d5068  ldr r5, [sp, #104]  ; 0x68
380cfca0: e59d606c  ldr r6, [sp, #108]  ; 0x6c
380cfca4: e59d7070  ldr r7, [sp, #112]  ; 0x70
380cfca8: e1a08120  lsr r8, r0, #2
380cfcac: e1a091a1  lsr r9, r1, #3
380cfcb0: e1a0a122  lsr sl, r2, #2

After enable thumb:
  .syntax unified
  .thumb
or
  -Wa,-mthumb

.Lhobot_i8_i32_gemm_nn_m4_n8_neon:
38001100: e92d 4ff0   stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
38001104: ed2d 8b10   vpush {d8-d15}
38001108: 9c19        ldr r4, [sp, #100]  ; 0x64
3800110a: 9d1a        ldr r5, [sp, #104]  ; 0x68
3800110c: 9e1b        ldr r6, [sp, #108]  ; 0x6c
3800110e: 9f1c        ldr r7, [sp, #112]  ; 0x70
38001110: ea4f 0890   mov.w r8, r0, lsr #2
38001114: ea4f 09d1   mov.w r9, r1, lsr #3
38001118: ea4f 0a92   mov.w sl, r2, lsr #2

This commit will enable the thumb option of the assembly file by default,
so that when compiling the assembly file, the machine code and the system will be in a consistent state.

----------------------------------------------------------------
https://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/ARM-Options.html

GCC Manual:
-mthumb
  Generate code for the Thumb instruction set. The default is to use the 32-bit ARM
  instruction set. This option automatically enables either 16-bit Thumb-1 or mixed 16/32-bit
  Thumb-2 instructions based on the -mcpu=name and -march=name options.

  ** This option is not passed to the assembler. **
  ** If you want to force assembler files to be interpreted as Thumb code,
     either add a `.thumb' directive to the source or pass the -mthumb option
     directly to the assembler by prefixing it with -Wa. **

Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-01 22:14:34 +01:00
chao an
d321080351 arm/cortex-[a|r]: generating assemble code in ARM states by default
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-01 22:14:34 +01:00
Peter van der Perk
90472785d3 S32K3XX QSPI No need to check TX FIFO buffer when MPU is correctly configured 2022-12-01 08:00:32 -05:00
Peter van der Perk
ec5030ebe6 S32K3XX RAM fixes MPU Dcache ECC 2022-12-01 08:00:32 -05:00
Masayuki Ishikawa
f7937d11a2 arch: arm64: Fix qemu_pl011_txint() in qemu_serial.c
Summary:
- I noticed that the nsh prompt can not be shown when disabling
  debug features. Actually, the prompt will be shown when a user
  input happens.
- This commit fixes this issue by adding uart_xmitchars() as
  other serial drivers do.

Impact:
- None

Testing:
- Tested with qemu-armv8a:netnsh on QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-12-01 19:38:03 +08:00
Masayuki Ishikawa
3b2685409a arch: risc-v: Fix nsec overflow in riscv_mtimer_current()
Summary:
- I noticed that mtimer stops around 30min after boot.
- Finally, I found that nesc overflows in riscv_mtimer_current().
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested with rv-virt:nsh on QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-12-01 19:33:39 +08:00
chao an
12b0fa9ec3 arm/sama5: fix recursive dependency
arch/arm/src/sama5/Kconfig:819:error: recursive dependency detected!
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
arch/arm/src/sama5/Kconfig:819:	choice <choice> contains symbol SAMA5_FLEXCOM0_USART
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
arch/arm/src/sama5/Kconfig:824:	symbol SAMA5_FLEXCOM0_USART is part of choice SAMA5_FLEXCOM0_USART
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
arch/arm/src/sama5/Kconfig:824:	symbol SAMA5_FLEXCOM0_USART is part of choice <choice>

Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-01 09:45:09 +08:00
TimJTi
a634da9a30 Fix SAMA5D2 ADC and TSD problems
SAMA5Dx ADC and TSD fixes

Ensures ADC and TSD work together. TSD now works on SAMA5D2 and should be OK, still, for other SAMA5D familiy members

Fix CI error

checkpatch error

Update arch/arm/src/sama5/sam_tsd.h

Squash commits to arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Squash commits to arch/arm/src/sama5/sam_tsd.c

Update arch/arm/src/sama5/sam_tsd.c

Update arch/arm/src/sama5/sam_tsd.c

Update arch/arm/src/sama5/sam_tsd.c

Update sam_tsd.c

Fixes after feedback from PR and additional testing

Update sam_tc.c

checkpatch.sh error was missed when fixing someone else's error...

feedback corrections missed

Co-Authored-By: Xiang Xiao <xiaoxiang781216@gmail.com>
Co-Authored-By: Petro Karashchenko <petro.karashchenko@gmail.com>

squashed everything after 248072e02C
2022-12-01 01:51:12 +08:00
TimJTi
57a21fbe1a Fixes for SAMA5D2 Flexcom USART
squashed everything after 8f8b8f5e05

Update Kconfig

Update Kconfig
2022-11-30 23:14:17 +08:00
Masayuki Ishikawa
1eb3d01956 arch: arm64: Add qemu_virtio.c
Summary:
- This commit adds qemu_virtio.c

Impact:
- None

Testing:
- Tested with qemu-armv8a:netnsh (will be added later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
Masayuki Ishikawa
b1ebca68f1 arch: arm64: Remove arm64_netinitialize() from qemu_boot.c
Summary:
- This commit removes arm64_netinitialize() from qemu_boot.c

Impact:
- None

Testing:
- Tested with QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
Masayuki Ishikawa
8053931d31 arch: qemu-rv: Add qemu_rv_virtio.c
Summary:
- This commit adds qemu_rv_virtio.c

Impact:
- None

Testing
- Tested with rv-virt:netnsh (will be added later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
ligd
b71f124b7b armv7-r: correct the wrong usage of ARMV7A_XX marco
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 12:21:32 +01:00
TimJTi
578f7783c6 Corrects PIO errors and omissions for SAMA5D2
Changes and corrections after review

Correct slow clock config
2022-11-28 16:37:44 +08:00
Xiang Xiao
6d30726a1b Remove the unnecessary "return;" at the end of function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:23:50 +01:00
chao an
6fa60627eb net/devif/ip: build l2 header on the IP layer
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:13:45 +08:00
chao an
8850dee746 net/devif: move preprocess of txpoll into common code
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:11:12 +08:00
Nathan Hartman
03802dad13 NuttX graduated the Incubator; update repository links 2022-11-26 11:58:15 -08:00
zouboan
b45f113943 boards/sparc add initial support of s698pm-dkit board 2022-11-25 08:54:28 -03:00
Lee Lup Yuen
b31054b1e3 arch/arm64: Add support for PINE64 PinePhone
This PR adds support for PINE64 PinePhone and the Allwinner A64 SoC (based on Arm Cortex-A53).

With this PR, PinePhone boots successfully to nsh (via microSD Card) and runs console apps.

-   `arch/arm64/Kconfig`: Added Allwinner A64 SoC

-   `boards/Kconfig`: Added PINE64 PinePhone

-   `arch/arm64/src/a64/Kconfig`: New Kconfig for Allwinner A64 SoC

-   `boards/arm64/a64/pinephone/Kconfig`: New Kconfig for PINE64 PinePhone

-   `src/a64/a64_boot.c`, `a64_boot.h`: Boot functions for Allwinner A64

-   `src/a64/a64_lowputc.S`: Low-level console output

-   `src/a64/a64_serial.c`, `a64_serial.h`: A64 Serial Driver

-   `src/a64/chip.h`: A64 SoC Definitions

-   `include/a64/chip.h`: A64 Memory Map, Generic Interrupt Controller

-   `include/a64/irq.h`: A64 Interrupts

-   `src/a64/Make.defs`: Source files for A64

-   `configs/nsh/defconfig`: Board Configuration for `pinephone:nsh`

-   `src/pinephone_appinit.c`: Init PinePhone

-   `src/pinephone_boardinit.c`: Init PinePhone

-   `src/pinephone_bringup.c`: Start PinePhone Drivers

-   `src/pinephone.h`: PinePhone Declarations

-   `include/board_memorymap.h`: PinePhone Memory Map

-   `scripts/dramboot.ld`: PinePhone Linker Script

-   `scripts/Make.defs`: Source files for PinePhone

-   `src/Makefile`: PinePhone Makefile

-   `platforms/arm/a64/boards/pinephone/index.rst`: Building and booting NuttX on PinePhone

-   `platforms/arm/a64/index.rst`: Overview of Allwinner A64

-   `introduction/supported_platforms.rst`: Added Allwinner A64

-   `introduction/detailed_support.rst`: Added Allwinner A64
2022-11-25 17:19:48 +08:00
Alan Carvalho de Assis
0e57e69b08 Add libc_stubs functions to get hmac_md5()
Co-author: Gustavo Nihei <gustavo.nihei@espressif.com>
Co-author: Lucas Vaz <lucas.vaz@espressif.com>
2022-11-25 10:26:37 +08:00
田昕
28739b8b8a libc/stream:Add mtd backend stream.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-11-24 12:07:10 +08:00
Ville Juven
52228fd222 stm32f7: Fix compliation of stm32_flash.c (add stm32_waste.c)
/arch/arm/src/libarch.a(stm32_flash.o): in function `up_progmem_write':
/arch/arm/src/chip/stm32_flash.c:419: undefined reference to `stm32_waste'

Seems like the symbol definition + declaration were completely missing
2022-11-23 20:30:26 +08:00
Ville Juven
321b9ea732 stm32f7/stm32_bbsram.c: Fix build error due to changed include path
Use correct path to include mutex.h

Fixes:

chip/stm32_bbsram.c:42:10: fatal error: mutex.h: No such file or directory
   42 | #include <mutex.h>
      |          ^~~~~~~~~
2022-11-23 18:20:29 +08:00
Xiang Xiao
04f887b56d Fix Error: chip/stm32_eth.c:1892:7: error: variable 'i' set but not used
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-23 07:27:48 +01:00
Xiang Xiao
79d02c0e29 arch/sim: Unify the host soruce file naming
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 19:37:48 +01:00
Tiago Medicci Serrano
d3ffeb40a7 libc/machine/xtensa: make longjmp safe against context switch
In order to turn longjmp context-switch safe, it's necessary
to disable interrupts before modifying windowbase and windowstart.
Otherwise, after a context switch, windowstart and windowbase
would be different, leading to a wrongly set windowstart bit due to
longjmp writing it based on the windowbase before the context switch.
This corrupts the registers at the next window overflow reaching
that wrongly set bit.

*Background:*
This PR is related to an issue first observed on ESP-IDF
https://github.com/espressif/esp-idf/issues/5229 and it was, then,
checked on NuttX using a test application.

*The test application:*
To check if the problem affects ESP32, ESP32-S2 and ESP32-S3 on
NuttX, it was created an application based on:
https://en.cppreference.com/w/c/program/longjmp

The application creates 16 tasks (`#define NUMBER_OF_TASKS  16`)
that implements the following daemon:

```
static int setjmp_longjmp_daemon(int argc, char *argv[])
{
  for (int i = 0; i < NUMBER_OF_TASKS * 2; i++)
    {
      jmp_buf env;

      volatile int count = 0;
      if (setjmp(env) != UINT16_MAX)
        {
          foo(&env, ++count);
        }
    }

  sem_post(&g_sem);

  return EXIT_SUCCESS;
}
```

The main function also initializes a semaphore to avoid application
exiting before tasks return successfully:

```
  sem_init(&g_sem, 0, -NUMBER_OF_TASKS);
```

Finally, the round-robin interval was lowered to 1ms to raise the
chances of the longjmp being interrupted by a context switch
(`CONFIG_RR_INTERVAL=1).

This setup was able to reproduce the problem prior to this patch
being applied.
2022-11-22 19:34:44 +01:00
chao an
f23ec0f995 Revert "tools/ci/arm/llvm/clang: bump up LLVMEmbeddedToolchainForArm to release-15.0.2"
This reverts commit b4bab51e86.

Issue:
Builtin math symbols are missing on llvm 15.0.2(libm.a):
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/issues/158

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 07:43:02 -08:00
zhangyuan21
d8051ba979 nuttx/sched: merge up_block_task and up_unblock_task 2022-11-22 22:59:08 +08:00
zhangyuan21
a8fa51e6bf arch: rename arch special function name 2022-11-22 16:27:56 +08:00
chao an
fc65e6969d arm/llvm/clang: add support for LLVMEmbeddedToolchainForArm release-15.0.2
Upstream:
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/tag/release-15.0.2

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 08:56:20 +01:00
zhangyuan21
5c1b518314 nuttx/sched: move reprioritize process to public function 2022-11-22 15:29:00 +09:00
zhangyuan21
08f7152d9f nuttx/sched: remove nxsched_remove_readytorun from up_block_task
It takes about 10 cycles to obtain the task list according to the task
status. In most cases, we know the task status, so we can directly
add the task from the specified task list to reduce time consuming.
2022-11-22 15:29:00 +09:00
zhangyuan21
e54b602208 nuttx/sched: remove nxsched_remove_blocked from up_unblock_task
It takes about 10 cycles to obtain the task list according to the task
status. In most cases, we know the task status, so we can directly
delete the task from the specified task list to reduce time consuming.
2022-11-22 15:29:00 +09:00
chao an
624d69ee05 boards: enter/leave critical section should in pairs
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 08:19:24 +09:00
Tiago Medicci Serrano
d492a5b092 esp32s2/i2s: implement I2S receiver module
- Add ioctl method to enable allocating the apb buffer.
- Add RX methods to set data width, sample rate, channels and
for receiving data from the I2S peripheral.
- Update the i2schar defconfig to enable the I2S receiver.
- Add nxlooper defconfig to enable testing the RX interface.
- Add specific bindings on ESP32-S2  bringup to enable nxlooper
to work without the need of any specific codec.
2022-11-21 23:46:47 +08:00
Karel Kočí
f0321d6bae arch/arm/src/samv7: fix missing sam_pendsv
The commit d1a3f5e47f invalidly removed
`sam_pendsv` instead of `sam_busfault`.
2022-11-21 23:45:24 +08:00
Eero Nurkkala
6596f0e99a risc-v/mpfs: fix compile warning
After commit b7d2b38, the system suffers from -Warray-bounds warning with -Wall:

chip/mpfs_opensbi.c: In function 'mpfs_hart_to_scratch':
chip/mpfs_opensbi.c:251:26: warning: array subscript hartid is outside array bounds of 'sbi_scratch_holder_t[0]' {aka 'struct sbi_scratch_holder_s[]'} [-Warray-bounds]
  251 |   return (unsigned long)(&g_scratches[hartid].scratch);

Fix it by reverting back to what is was earlier. g_scratches shouldn't be in the bss
region that would be zeroed out.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-11-21 14:43:34 +01:00
flyingfish89
f420b4dce7 esp32c3:fix i2c bug of timout
Signed-off-by: flyingfish89 <2914061332@qq.com>
2022-11-21 12:02:21 +01:00
Xiang Xiao
ab31236905 Fix Error: chip/stm32_tim_lowerhalf.c:479:54: error: format specifies type 'unsigned long' but the argument has type 'uint32_t'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
ea171d6e5d Fix Error: chip/stm32_spi.c:571:23: error: unused function 'spi_getreg8'
and unused function 'spi_putreg8'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
6386596731 Fix Error: chip/stm32_qencoder.c:989:46: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
27629b74c9 Fix Error: chip/stm32_serial.c:1542:20: error: unused function 'up_serialmod'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
4e6568c29a Fix Error: chip/stm32l4_dfumode.c:45:20: error: unused function 'rcc_reset'
and unused function 'apb_reset'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
4cc52f277b Fix Error: chip/stm32l4_pwr.c:50:20: error: unused function 'stm32l4_pwr_modifyreg'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
30a153d2a0 Fix chip/stm32l562xx_rcc.c:78:20: error: unused function 'rcc_reset'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
59a747ee36 Fix error: chip/stm32l5_pwr.c:50:20: error: unused function 'stm32l5_pwr_modifyreg'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Lee Lup Yuen
6aba739f05 arch/arm64: Add support for Generic Interrupt Controller Version 2
Currently NuttX on Arm64 supports Generic Interrupt Controller (GIC) Versions 3 and 4: [`arm64_gicv3.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gicv3.c), [`arm64_gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm64/src/common/arm64_gic.h). This PR adds support for GIC Version 2, which is needed by [Pine64 PinePhone](https://lupyuen.github.io/articles/interrupt) based on Allwinner A64 SoC.

This 64-bit implementation of GIC v2 is mostly identical to the existing GIC v2 for 32-bit Armv7-A ([`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c), [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h)), with minor modifications to support 64-bit Registers (Interrupt Context).

-   `arch/arm64/Kconfig`: Under "ARM64 Options", we added an integer option `ARM_GIC_VERSION` ("GIC version") that selects the GIC Version. Valid values are 2, 3 and 4, default is 3.

-   `arch/arm64/src/common/arm64_gicv2.c`: Implements 64-bit GIC v2 based on 32-bit [`armv7-a/arm_gicv2.c`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/arm_gicv2.c) and [`armv7-a/gic.h`](https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-a/gic.h), modified to support 64-bit Registers (Interrupt Context).

    Function and Macro Names have not been changed, for easier cross-referencing between the 32-bit and 64-bit implementations of GIC v2.

-   `arch/arm64/src/common/arm64_gicv3.c`: Added Conditional Compilation for GIC v3. This file will not be compiled if `ARM_GIC_VERSION` is 2.

-   `arch/arm64/src/common/arm64_gic.h`: Added the Version Identifier for GIC v2. At startup we read the GIC Version from hardware and verify that it matches `ARM_GIC_VERSION`.

-   `arch/arm64/include/qemu/chip.h`: Added the QEMU Base Addresses for GIC v2.

-   `arch/arm64/src/common/Make.defs`: Added the source file that implements GIC v2.

-   `boards/arm64/qemu/qemu-armv8a/README.txt`: Added the documentation for testing GIC v2 with QEMU.

-   `boards/arm64/qemu/qemu-armv8a/configs/nsh_gicv2/defconfig`: Added the Board Configuration `qemu-armv8a:nsh_gicv2` for testing GIC v2 with QEMU. Identical to `qemu-armv8a:nsh`, except that `ARM_GIC_VERSION` is 2.
2022-11-20 21:44:12 -08:00
Xiang Xiao
f28cfbf2f3 Fix chip/stm32_eth.c:3358:20: error: unused function 'stm32_selectrmii'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
720acac6af Fix chip/stm32_usbdev.c:929:20: error: unused function 'stm32_setstatusout'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
6af9afaa60 Fix error: more '%' conversions than data arguments
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
22768ede17 Fix chip/sam_tc.c:682:24: error: unused function 'sam_tc_getreg'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
d01fbf77d0 Fix chip/sam4l_clockconfig.c:923:20: error: unused function 'sam_enable_fastwakeup'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
d3e282e561 Fix chip/s32k3xx_qspi.c:925:44: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
d8e53d7b4f Fix error: format specifies type 'unsigned long' but the argument has type 'unsigned int'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
670c3e0e35 Fix chip/s32k3xx_lpi2c.c:624:3: error: unused function 's32k3xx_lpi2c_sem_waitstop'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
987d2561c0 Fix chip/s32k3xx_fs26.c:249:31: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
e18d5870db Fix chip/s32k3xx_lpspi.c:719:23: error: unused function 's32k3xx_lpspi_readbyte'
and chip/s32k3xx_lpspi.c:748:20: error: unused function 's32k3xx_lpspi_writebyte'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
658dfeaf40 Fix chip/kinetis_spi.c:473:23: error: unused function 'spi_getreg8'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
6fd08787b6 Fix chip/kinetis_usbdev.c:3317:1: error: unused function 'khci_epreserved'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
232360cbd0 Fix chip/kinetis_enet.c:875:59: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
9a50c30168 Fix chip/imxrt_enc.c:950:27: error: use of logical '&&' with constant operand
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
4913552140 Fix chip/imxrt_lpspi.c:553:23: error: unused function 'imxrt_lpspi_readbyte'
and chip/imxrt_lpspi.c:580:20: error: unused function 'imxrt_lpspi_writebyte'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
3ecf66415c Fix chip/imxrt_serial.c:1375:20: error: unused function 'imxrt_disableuartint'
and chip/imxrt_serial.c:1400:20: error: unused function 'imxrt_restoreuartint'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
9f7d7c046a Fix chip/imxrt_lpi2c.c:1254:1: error: unused function 'imxrt_lpi2c_getenabledints'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
427f65ac28 Fix chip/imxrt_lpi2c.c:755:1: error: unused function 'imxrt_lpi2c_sem_waitstop'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
Xiang Xiao
f9479885ba arch/arm64: Move group_addrenv to arm64_syscall_switch
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 08:17:03 -03:00
Xiang Xiao
63bcca985f arch/armv7-r: Don't clear SCTLR_U bit since spec require it's always one
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-19 14:42:22 -03:00
Xiang Xiao
4d56ef5d8c arch/armv7-a: Support the big endian in arm_pghead.S like arm_head.S
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-19 14:42:22 -03:00
Xiang Xiao
4abd626288 arch/armv7-r: Remove the nonexistent SCTLR_IE
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-19 14:42:22 -03:00
raiden00pl
04a66d2d3a arch/stm32g4: fix ADC clock after ef517ed 2022-11-17 19:53:53 +08:00
raiden00pl
f22ef83cd6 arch/stm32f3: fix ADC clock after ef517ed 2022-11-17 19:53:53 +08:00
raiden00pl
b239985037 stm32f30xxx_rcc.c: remove code that refers to STM32F1 specific definitions 2022-11-17 19:53:53 +08:00
qinwei1
8021dfece6 sched/task/task_getpid: getpid should return process id not thread id
Summary:
   implement the right semantics:
1. getpid should return the main thread id
2. gettid should return the current thread id

Refer to:
 https://github.com/apache/incubator-nuttx/issues/2499
 https://github.com/apache/incubator-nuttx/pull/2518

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2022-11-17 17:58:08 +08:00
Ville Juven
596ce5e7b1 riscv/addrenv: Implement up_shmat/shmdt for RISC-V
These are great utility functions to create/destroy anonymous mappings
2022-11-17 09:16:54 +08:00
Ville Juven
5c29042ab4 riscv/mmu: Implement mmu_ln_clear
Implement procedure to clear a mapping from MMU
2022-11-17 09:16:54 +08:00
Ville Juven
85470adcc3 riscv/addrenv: Make private function get_pgtable into a public one
The utility function can be used from other places
2022-11-17 09:16:54 +08:00
Xiang Xiao
e047ca6011 Fix arch/arm/src/samv7/sam_pwm.c:489:1: error: Missing blank line after comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-16 14:37:44 -03:00
Ville Juven
093760b48c mpfs_head.S: Mark .start section attributes explicitly
a = allocated, x = executable. Otherwise the input section type will
become empty, which means output section will be empty as well.
2022-11-16 23:32:51 +08:00
Simon Filgis
6376d90c3d In case of SAMV7 it is possible to overwrite the pwm output with 0 or 1 immediately. Changing the dutycycle to 0 or 100 will take effect only on end of cycle, which could be to late for some applications.
This solution adds a overwrite flag and value when updating the duty cycle.
2022-11-16 12:07:09 +08:00
Tiago Medicci Serrano
aa208bd52c esp32/i2s: remove "esp32_" prefix from private functions 2022-11-15 17:01:47 -03:00
Tiago Medicci Serrano
3b5ab27893 esp32/i2s: implement I2S receiver module
- Add ioctl method to enable allocating the apb buffer.
- Add RX methods to set data width, sample rate, channels and
for receiving data from the I2S peripheral.
- Update the i2schar defconfig to enable the I2S receiver.
- Add nxlooper defconfig to enable testing the RX interface.
- Add specific bindings on ESP32 bringup to enable nxlooper
to work without the need of any specific codec.
2022-11-15 17:01:47 -03:00
Tiago Medicci Serrano
7ae4152f47 esp32[-s2]/i2s: fix gpio setting when slave mode is selected 2022-11-15 17:01:47 -03:00
David Sidrane
97930ab110 imxrt:Fix Case ENET_MMFR_OP_RdNOTMII->ENET_MMFR_OP_RDNOTMII 2022-11-15 02:27:35 +08:00
David Sidrane
d05a5d16ee imxrt:Support TJ1103 PHY 2022-11-15 02:27:35 +08:00
Xiang Xiao
93fe5a3d0d arch/stm32/1wire: Don't free the context if the reference doesn't equal zero
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 11:40:08 -03:00
Xiang Xiao
8a8e115623 arch: Initialize usbhost_connection_s directly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
Xiang Xiao
148c544759 Don't check nxsem_init and nxmutex_init
since both never fail

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
Xiang Xiao
e244720aa4 bl602/spi: add reference in bl602_spibus_initialize
and unlock the mutex before return

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
Xiang Xiao
8098c80338 arch: Don't free the context if the reference doesn't equal zero
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
Xiang Xiao
67686c231a Call nxmutex_destroy and nxsem_destroy in error patch to avoid the leak
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00