Commit Graph

7275 Commits

Author SHA1 Message Date
wangjianyu3
d1b87bd021 Add thermal framework
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
b78c9a7067 boardctl.h: Add BOARDIOC_SOFTRESETCAUSE_THERMAL reset cause
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
likun17
2b59a0a19b lzf: Add macro judgment to header file reference.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-21 03:00:13 +08:00
guoshichao
d26357d3e6 nuttx/math: fix greenhills build warning on using sizeof with operand
the detailed warning info are:
CC:  syslog/vsyslog.c "pthread/pthread_create.c", line 443: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
          ptcb->cmn.timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                                ^

CC:  dirent/lib_closedir.c "sched/sched_profil.c", line 81: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
    wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
                           ^

"sched/sched_profil.c", line 142: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
    wd_start(&prof->timer, PROFTICK, profil_timer_handler, (wdparm_t)prof);
                           ^

CC:  common/arm_modifyreg8.c "sched/sched_setscheduler.c", line 165: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
            tcb->timeslice  = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

CC:  misc/lib_utsname.c "sched/sched_unlock.c", line 275: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
            rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

"sched/sched_roundrobin.c", line 119: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
            tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                             ^

CC:  armv7-m/arm_fpuconfig.c cxarm: Error: No files.  Try -help.
CC:  misc/lib_crc8ccitt.c cxarm: Error: No files.  Try -help.
cxarm: Error: No files.  Try -help.
CC:  getprime_main.c cxarm: Error: No files.  Try -help.
cxarm: Error: No files.  Try -help.
CC:  misc/lib_log2ceil.c cxarm: Error: No files.  Try -help.
CC:  task/task_start.c "task/task_setup.c", line 423: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
        tcb->timeslice      = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-20 22:01:36 +08:00
likun17
71876ae098 lib_libvscanf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
likun17
89a3f28a76 lib_libvsprintf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
Petro Karashchenko
f0267bc507 arch/arm/samv7: add support of SocketLIN interface
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-19 09:39:54 +08:00
yinshengkai
f326f15b40 sched: move DUMP_ON_EXIT to sched
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:49:12 +08:00
wangjianyu3
ffac2a314b driver/sensors: Support GNSS Geofence
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
bf83b3fafc driver/sensors: Support GNSS Measurement & Clock
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
e830db0316 driver/sensors: Add constellation for GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
c652f41c87 nuttx/uorb: Rename GPS to GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
b17c074a18 nuttx/uorb: change unsigned long to uint32 to fix size issue
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
403469336f driver/sensors: support sensor flush operation
Supports the flush operation of the sensor.

The application can initiate a flush action through ioctl SNIOC_FLUSH
to trigger flush, and the call will be returned immediately.
Using SNIOC_GET_EVENTS to clear flush event,

However, the flush implementation is asynchronous, when all the flush
data is push to upper circbuffer, the POLLPRI event(FLUSH_COMPLETED)
will be reported.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
likun17
703bb7e7b3 sensor.c: Added new interface for obtaining and setting sensor device information.
When there is an actual physical sensor, the driver must implement the get info interface. The upper layer can obtain the actual physical sensor information through SNIOC_GET_INFO.
SNIOC_SET_INFO can only set the information of the local virtual sensor, which means it is bound to the local advertisement. Remote subscribers cannot set the information.

Usage:
  struct sensor_device_info dev_info;
  orb_ioctl(fd, SNIOC_GET_INFO, (unsigned long)(uintptr_t)&dev_info);

  or:
  ret = orb_set_info(fd, &dev_info);
  ret = orb_get_info(fd, &dev_info);

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 03:44:49 +08:00
yanghuatao
236678d730 toolchain/ghs: Fix CONFIG_SCHED_CRITMONITOR_MAXTIME_XXX "zero used for undefined preprocessing identifier" warnings
"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-19 03:16:14 +08:00
ligd
90dcd5edd3 critmonitor: add caller support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-19 03:16:14 +08:00
yinshengkai
e28b311b78 Make each function of SCHED_CRITMONITOR independent
There will be a large performance loss after SCHED_CRITMONITOR is enabled.
By isolating thread running time-related functions, CPU load can be run with less overhead.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-19 03:16:14 +08:00
wangmingrong1
969a5b510e compiler.h: AVR 2-byte PC and 3-byte PC do not support returnaddress
Compilation error:
Kasan/book. c: In the function '__hwasanloaded 16_noabort':
Kasan/book. c: 76:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, false, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
Kasan/book. c: In the function '__hwasan_store16_noabort':
Kasan/book. c: 80:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, true, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
CC: hello. min c hello. min c: In the function 'hello. min':
Hello. main. c: 39:3: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
printf("Hello, World: %p!!\n", return_address(0));

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
b49eef7f4e mm/kasan: The complete implementation of inline instrumentation functions
1. Use always_inline_function instead of inline, inline does not take effect
2. Activate Kasan acceleration by 1/7

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
b7d5a30f85 include/nuttx.h: add common align definitions for nuttx
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
87dc91b588 mm/kasan: add kasan watch point implementation
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
ae7a3d7071 mm: move kasna_start/stop to hook.c
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
2d8b582ce6 kasan:add kasan_start/stop api to control kasan check
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
5ee7c563a5 mm: add kasan_unregister implementaion
In mm_uninitialize should unregister kasan

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong
ae3facda53 kasan: Implementation of Kasan based on software tags.
Currently, only aarch64 is supported

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-09-19 03:15:29 +08:00
Xiang Xiao
9c6bed4b00 mm: Move kasan.h from mm/kasan to include/nuttx/mm
so other parts of the system can use it.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-19 03:15:29 +08:00
chenrun1
d04205aa3d fs/mmap/msync:support msync.
Summary:
  1.Added msync callback in struct mm_map_entry_s
  2.Added msync API in fs_msync.c
  3.Added static msync_rammap for rammap.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-19 01:43:50 +08:00
Xiang Xiao
f76c2ed83b can: Add g_ prefix to can_dlc_to_len and len_to_can_dlc.
detail: Add g_ prefix to can_dlc_to_len and len_to_can_dlc to
follow NuttX coding style conventions for global symbols,
improving code readability and maintainability.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-09-18 23:50:11 +08:00
chao an
3cce16dd0c fs/dump: correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
1. correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
2. dump file list only if DUMP_ON_EXIT enabled

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-18 23:48:31 +08:00
hujun5
a2c704a84a Revert "irq: add [enter|leave]_critical_section_nonirq"
This reverts commit 1c5a0bf6cc.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-17 20:12:59 +08:00
YAMAMOTO Takashi
03b0b05c69 fs.h: fix a comment in file_operations 2024-09-17 20:11:29 +08:00
ouyangxiangzhen
5975cc9d96 signal: Make struct sigevent compatible with glibc
This patch added compatible struct sigevent definition with glibc.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-17 12:15:14 +08:00
ligd
578ecef975 wdog: add new API wd_start_realtime() support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-17 12:15:14 +08:00
ligd
9c423ee5fa wdog: rename wd_start_absolute() to wd_start_abstick()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-17 12:15:14 +08:00
ouyangxiangzhen
213d5538fc signal: Add support for SIGEV_THREAD_ID and sigev_notify_thread_id
This patch added support for SIGEV_THREAD_ID and sigev_notify_thread_id.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-17 12:15:14 +08:00
zhangshoukui
13dd7bbfb3 Add reference count configuration
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-09-17 12:01:53 +08:00
Shoukui Zhang
43223124ec vfs/file: add reference counting to prevent accidental close during reading writing...
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-09-17 12:01:53 +08:00
ligd
42b6dd0ff1 wqueue: extend the work_cancel_sync() return value
Return 1 to indicate the work was not cancelled.
Because it is currently being processed by work thread,
but wait for it to finish.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-17 02:56:39 +08:00
dongjiuzhu1
1d5f43664d driver/pinctl: add pinctrl framework
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-17 02:25:47 +08:00
Karel Kočí
b04da1892e libs/libc/obstack: implement ptr and int growing functions
The new API is defined by GNU and implemented in other LibCs, such as
Musl.

This also modifies API of obstack_blank_fast and obstack_1grow_fast.
These are defined as returning void and thus return value here is
incompatibility with other implementations.
2024-09-17 02:00:46 +08:00
liaoao
896f02bd67 rpmsg_port_spi: add nbits to spicfg
Support more spi config paramters for Rpmsg Port SPI/SPI Slave

Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-17 01:55:51 +08:00
Bowen Wang
76572f9892 rpmsg/rpmsg_port_uart: add rpmsg uart port driver
Rpmsg Port Uart is a new rpmsg transport layer.
Just like the rpmsg port spi, the difference is that the physical
communication method changed from SPI to UART.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-17 01:55:51 +08:00
liaoao
4827063958 rpmsg_port_spi: add spi slave support
The rpmsg port spi slave version support

Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-17 01:55:51 +08:00
Bowen Wang
ab47465dd5 drivers/rpmsg: add get_local_cpuname to rpmsg ops
Add get_local_cpuname to the rpmsg framework ops to support communicate
with the same remote core with multi rpmsg transport.

Some rpmsg services will send local cpu name to remote core and then let
remote core to connect local core by using this cpu name, when there are
multi rpmsg channels with same remote core, the remote core may connect
to incorrect core, so use the error rpmsg channel.

For example, there are two rpmsg channels between ap and audio:

ap core                     audio core
 [ap1] <-- rpmsg virtio1 --> [audio1]
 [ap2] <-- rpmsg virtio2 --> [audio2]

When we want to use the rpmsg virtio1 to communicate, ap core may send
local cpuname "ap2" to audio, so the audio core use remote cpu "ap2" to
connect with ap, and resulting in the use of incorrect rpmsg channel.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-17 01:55:51 +08:00
yintao
7c933874e8 drivers/rpmsg: add rpmsg router support
Rpmsg Router is new rpmsg transport layer, it can router the rpmsg
messages to a cpu that not directly connected with local cpu by Rpmsg,
For the rpmsg services, it is as if there is a real Rpmsg Channel between
the local cpu and the remote cpu.

For examples, there are three cpus: ap, cp and audio.
ap and cp, ap and audio has share memory and be connected by Rpmsg VirtIO,
so ap and cp, ap and audio can communicate with each other by Rpmsg, but
cp can not communicate with audio direclty.

[cp] <-- rpmsg virtio --> [ap] <-- rpmsg virtio --> [audio]

With rpmsg router, the cp can communicate with audip by Rpmsg dereclty because
the router in ap will forward the rpmsg message from cp/audio to audio/cp, like
this:

 +<----- rpmsg router --> hub  <-- rpmsg router ------>+
 |                         |                           |
[cp] <-- rpmsg virtio --> [ap] <-- rpmsg virtio --> [audio]

Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-17 01:55:51 +08:00
liaoao
f7939a8081 rpmsg_port_spi: add spi transport layer
Add Rpmsg-Port-SPI transport layer.
Rpmsg Port SPI is a new rpmsg transport layer based on the Rpmsg Port,
it provides the capability for two SPI-connected (and two extra GPIO)
chips to communicate with each other using Rpmsg.

All already implemented Rpmsg Services can be used with this new transport
layer without any modifications.

Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-17 01:55:51 +08:00
liaoao
dd66a6b203 rpmsg_port:reduce len and avail of rpmsg_port_header_s to uint16_t
uint16_t is enough and more suitable

Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-17 01:55:51 +08:00
liaoao
6d604ec487 rpmsg: add physical transport layer support
Rpmsg Physical Transport Layer is a new rpmsg transport, it's a
common part for the physical communication based rpmsg transport
layers such as Rpmsg-SPI and Rpmsg-Uart.

It implements three common parts:
1. Implement the NuttX and OpenAMP rpmsg frameworks' ops and the
rpmsg name service;
2. The buffer management and provide some APIs to lower layer to use;

Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-17 01:55:51 +08:00
p-szafonimateusz
1e212981b9 drivers/net: add support for Intel I225 network card
add support for Intel I225 network card

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-17 01:42:38 +08:00
p-szafonimateusz
bc0c7b0db3 drivers/net: add Intel e1000 network card support
add Intel e1000 network card support

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-17 01:42:38 +08:00
wanggang26
584931aa0d fix two typos
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-16 11:25:10 -03:00
wanggang26
0a8b6404d8 rwbuffer: fix a typo
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-16 09:22:23 -03:00
wanggang26
872208fdf8 boardctl: add board control api to start slave core
This interface may be used by application specific logic to start
specified slave cpu core under the pseudo AMP case which is different
with armv7-a/armv8-a SMP. Support for this function is required by
board-level logic if CONFIG_BOARDCTL_START_CPU is selected.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-16 13:03:33 +08:00
dongjiuzhu1
97d684847b drivers/reset: support rpmsg reset
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-15 20:21:41 +08:00
Xiang Xiao
908cd1b10a misc/goldfish_pipe: Refine the implementation
1.Merge goldfish_pipe_qemu.h into goldfish_pipe.c
2.Change all enum to macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-15 19:28:55 +08:00
zhanghu5
2ce2844480 drivers/misc: support nuttx goldfish_pipe
Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2024-09-15 19:28:55 +08:00
dongjiuzhu1
1bad603fe7 drivers/gpio: save memory if dont support signal
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-15 11:29:55 +08:00
dongjiuzhu1
28815fb7c5 drivers/gpio: add poll function for gpio device
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-15 11:29:55 +08:00
wangjianyu3
f2ca3753dd rpmsgdev_server: Support exporting devices
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:18:08 +08:00
p-szafonimateusz
51909ed59f drivers: fix gcc14 errors for PCI
fix gcc14 errors for PCI

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
8ab0785d71 drivers: add UART 16550 compatible PCI device support
add support for UART 16550 compatible PCI device.
For now we support qemu serial PCI devices and AX99100 based cards.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
ceb2921d79 drivers: prepare 16550 UART driver to support PCI
prepare 16550 UART driver to support PCI:

- [breaking change] change argument of uart_ioctl() from `struct file *filep` to `FAR struct u16550_s *priv`
  Also fix moxart_16550.c build related to this change

- [breaking change] change argument of uart_getreg() and uart_putreg from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`
  Also fix arch/x86/src/qemu/qemu_serial.c and arch/x86_64/src/intel64/intel64_serial.c related to this change

- [breaking change] change argument of uart_dmachan() from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`

- move `struct u16550_s` to public header

- generalize UART_XXX_OFFSET so we can use it with any register increment

- make u16550_bind(), u16550_interrupt(), u16550_interrupt() public

- remove arch/or1k/src/common/or1k_uart.c and use common 16550 MIMO interfacve

- change irq type in `struct u16550_s` from uint8_t to int to match MSI API

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
Xiang Xiao
1d586c3bee pci: Add driver_data to pci_device_id_s
so driver writer could save the private data here
and get it back in the probe function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-15 03:37:58 +08:00
wangyongrong
877e462990 vitrio-pci.c: add virtio-pci transport support for Nuttx
1. only support pci modern device;
2. need the pci controller support MSI/MSI-X;
It has been verified based on virtio-rng and virtio-net.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-15 02:22:16 +08:00
ligd
ff1b54bff3 pthread_cleanup: move clenup down to tls
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 20:15:12 +08:00
yintao
38af7001b6 drivers/rpmsg: fix the race condtion about rpmsg_device_created
xxx_rpmsg_device_created may be called repeatedly.

rptun thread				app thread

rptun_dev_start				xxx_rpmsg_init

...					rpmsg_register_callback
priv->...= rpmsg_ns_unbind;
priv->..= rptun_notify_wait;
					if (ns_unbind_cb)
(switch app thread)				device_created()
						xxx_rpmsg_device_created

					metal_list_add_tail(g_cb);
...
rpmsg_device_created();
	cb->device_created
	xxx_rpmsg_device_created;

Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-14 17:34:52 +08:00
Yongrong Wang
67e41d0e32 rpmsg/rpmsg_virtio_ivshmem: add rpmsg virtio ivshmem support
rpmsg_virtio_ivshmem is a ivshmem based rpmsg virtio driver,
with this driver, we can use the rpmsg virtio in qemu platfrom

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-14 17:34:52 +08:00
Yongrong Wang
af0bde8bca rpmsg virtio: add rpmsg virtio wrapper support
Rpmsg VirtIO is a virtio transport implementation for Rpmsg, and
it's different to the rptun framework.

rpmsg_virtio.c implements the rpmsg virtio transport layer by itself
to avoid use the remoteproc implementation in OpenAMP to save code
size, so it can be treated as a lightweight version of rptun.
Therefore, rpmsg_virtio.c only support the communication feature and
do not support contoll the life cycle of the remote core.
But benefit by it's small footprint, it can be used in the chips with
small flash.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-14 17:34:52 +08:00
fangpeina
401a06fb17 input/ff: modify FF_MAX to support 64-bit machine
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-09-14 13:44:49 +08:00
ouyangxiangzhen
dd88c7fcfa sys/mman: Add dummy implementations of shm_open and shm_unlink
This patch added dummy implementations of shm_open and shm_unlink.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 16:08:25 +08:00
ouyangxiangzhen
020dbe51e3 sched/pthread: Add dummy pthread_setaffinity_np
This patch added dummy pthread_setaffinity_np implementation if CONFIG_SMP is disabled.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 16:08:25 +08:00
ouyangxiangzhen
28d943b226 sys/resource: Add RLIMIT_RTPRIO and RLIMIT_RTTIME definition
This commit add the definition of RLIMIT_RTPRIO and RLIMIT_RTTIME.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 16:08:25 +08:00
liaoao
40e34b5b58 spi_slave: keep consistent with the parameter of the spi_slave_receive function declaration
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 12:27:31 +08:00
p-szafonimateusz
db6d0bd356 drivers/pci: add MSI/MSI-X support
Add support for MSI and MSI-X in PCI framework

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-13 09:42:08 +08:00
rongyichang
83c2a7f54e drivers/fb: add panbuffer clear ioctl
Some devices need to clear the fb panbuf when waking up from sleep
to avoid outputting residual buffers from before sleeping

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-09-13 09:15:38 +08:00
chao an
2b4ab6cd29 stream/syslograw: remove support for iob buffer in syslog
IOB buffer participates in the calculation of the congestion strategy
in the protocol stack, if the iob buffer is exhausted or there are
too many syslog printing tasks, the behavior of the protocol stack
and log printing will unable to determined, this PR will remove support
for iob buffer in syslog

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-13 09:14:56 +08:00
ouyangxiangzhen
0451ead2c5 fs/mmap: Ensure anonymous pages are initialized to zero
According to the mmap(2) specification, anonymous pages should be initialized to zero unless the MAP_UNINITIALIZED is specified.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 09:10:21 +08:00
ouyangxiangzhen
53c7612faf fs/mmap: Add MADV_HUGEPAGE definitions
This commit add MADV_HUGEPAGE and MADV_NOHUGEPAGE definitions for madvise. Notice that none of these flags have been implemented yet.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 09:10:04 +08:00
liaoao
6f770fb4b1 coresight: disable device before unregister
coresight_claim_device will fail when unregister device
which has been enabled. device should be the init state when
it is unregistered.

Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
8a57dafdcf coresight: add clk control for coresight system
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
df33c392ae coresight:add tmc device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
79af05c4ae coresight:add etb device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
71e4267a7a coresight: add etm3 device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
e3e23f7eaf coresight:add stm device
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
c0e40fc19f coresight:add tpiu device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
5324f69b58 coresight:add link coresight device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
8cc0c24318 coresight:add common api for coresight system
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao
24050ba59f coresight: add coresight_core
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
ligd
8b4b66ef73 clock: fix clock_timespec_subtract() error when use TIME32
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
zhangyuan29
fc5e37e57b math32: Integer overflow occurs in arithmetic on constant operands
https://coverity.pt.xiaomi.com/#/project-view/10098/10010?selectedIssue=1266083

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
7fc03e0084 lib: generic optimization for constant divisor on 32-bit machines
64-by-32-bit divisions are prominent in the NuttX, even on 32-bit
machines.  Luckily, many of them use a constant divisor that allows
for a much faster multiplication by the divisor's reciprocal.

The compiler already performs this optimization when compiling a 32-by-32
division with a constant divisor. Unfortunately, on 32-bit machines, gcc
does not optimize 64-by-32 divisions in that case, except for constant
divisors that happen to be a power of 2.

Let's avoid the slow path whenever the divisor is constant by manually
computing the reciprocal ourselves and performing the multiplication
inline.  In most cases, this improves performance of 64-by-32 divisions
by about two orders of magnitude compared to the __div64_32() fallback,
especially on architectures lacking a native div instruction.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
849b2e8c10 clock.h: use roundup to handle clock_time2ticks()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
f0d3c8ab2b usleep: use div_const to optimize the usleep
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
yinshengkai
62047aa3d0 time: fix 32-bit integer truncation warning
CID 1266677: (#2 of 2): Use 32-bit time_t (Y2K38_SAFETY)
1. declaration_with_small_time_t: Declare use of time_t, which is defined as 32 bits wide on this platform, while the minimum safe width is 64.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
zhangyuan29
f4a650a1c0 clock: Incorrect use of unsigned number
https: //coverity.pt.xiaomi.com/#/project-view/10098/10010?selectedIssue=1275849

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
a4ffa84974 clock: use div_const() to optimize the div speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
cce5280ebf clock: use div_const() to optimize the div speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
48f2a07ce7 clock: generic optimization for constant divisor on 32-bit machines
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
76e807560e clock: take clock_abstime2ticks() as MACRO
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00