Commit Graph

6903 Commits

Author SHA1 Message Date
Michal Lenc 3cc65d5d35 timers/mcp794xx: add option to digital trimming
MCP794XX supports digital trimming that periodically adds or subtracts
clock cycles, resulting in small adjustments in the internal timing.
This way inaccuracies of clock source can be compensated.

This commit adds option to set the trimming register for MCP794XX.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-05-28 16:34:41 -03:00
Stuart Ianna 42865caebd nuttx/arch.h: Update parameter type to match definition.
The definition of nxsched_process_cpuload_ticks uses clock_t, which is
portable across uint32_t and uint64_t timers, and works if CONFIG_SYSTEM_TIME64 is
defined.
2024-05-27 23:23:49 +08:00
buxiasen 07f0e0c166 PM: add stability governer
only when first time change state can hold WFI for enough time thresh,
allow second time goto target state,
suitable for the case when wakeup from sleep too slow, etc.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-23 09:57:19 -03:00
hujun5 61caf7cce9 types: on some arch, execution speed can be accelerated
in arm64 Let's see how the following code looks like in assembly

volatile cpu_set_t g_cpu_set;
cpu_set_t set_cpu_set_t_set(int cpu) {
  g_cpu_set &= ~(1 << cpu);
  return g_cpu_set;
}

when
typedef volatile uint32_t cpu_set_t;
Dump of assembler code for function set_cpu_set_t_set:
   0x0000000040288570 <+0>:	adrp	x2, 0x403ce000 <g_irqvector+1160>
   0x0000000040288574 <+4>:	ldr	w3, [x2, #2368]
   0x0000000040288578 <+8>:	mov	w1, #0x1
   0x000000004028857c <+12>:	lsl	w1, w1, w0
   0x0000000040288580 <+16>:	bic	w1, w3, w1
   0x0000000040288584 <+20>:	str	w1, [x2, #2368]
   0x0000000040288588 <+24>:	ldr	w0, [x2, #2368]
   0x000000004028858c <+28>:	ret

when
typedef volatile uint8_t cpu_set_t;
Dump of assembler code for function set_cpu_set_t_set:
   0x000000004028856c <+0>:	adrp	x2, 0x403ce000 <g_irqvector+1192>
   0x0000000040288570 <+4>:	ldrb	w3, [x2, #2336]
   0x0000000040288574 <+8>:	mov	w1, #0x1
   0x0000000040288578 <+12>:	and	w3, w3, #0xff           // At this time, there will be one more instruction
   0x000000004028857c <+16>:	lsl	w1, w1, w0
   0x0000000040288580 <+20>:	bic	w1, w3, w1
   0x0000000040288584 <+24>:	strb	w1, [x2, #2336]
   0x0000000040288588 <+28>:	ldrb	w0, [x2, #2336]
   0x000000004028858c <+32>:	ret

test:
We can use qemu for testing.

compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-05-22 19:10:03 +08:00
YAMAMOTO Takashi 1ee279c292 nuttx kconfig: rename a few recently-added options
from:
ARCH_TEXT_HEAP_SEPARATE_DATA_ADDRESS
ARCH_TEXT_HEAP_WORD_ALIGNED_READ

to:
ARCH_HAVE_TEXT_HEAP_SEPARATE_DATA_ADDRESS
ARCH_HAVE_TEXT_HEAP_WORD_ALIGNED_READ
2024-05-21 01:11:44 +08:00
YAMAMOTO Takashi d196f800b0 Add a few optional text heap APIs to support esp32s3
esp32s3's Internal SRAM 1 and External Memory have two separate mappings
for instructions and data.
2024-05-21 01:11:44 +08:00
yinshengkai f25a506f91 include: When defining NDEBUG, assert will implement alignment standards
As defined by the C standard, if NDEBUG is defined, assert should do nothing but be simply defined as:

  #define assert(ignore) ((void)0)

Reference link:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/assert.h.html

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-05-17 10:18:16 -03:00
dulibo1 3762bda5e2 pm: procfs add pm prepare fail stats
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-17 19:07:44 +08:00
Nicolas Lemblé 03dbb82db9 Add c symbols to std 2024-05-16 10:25:01 -03:00
shizhenghui ed1ad1be65 Add v4l2m2m & sim decoder
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-05-15 22:03:18 +08:00
shizhenghui 03c756dd74 videoio: modify data type of v4l2_buffer from uint32_t to uint16_t
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-05-15 22:03:18 +08:00
shizhenghui fecf2039d8 videoio: modify the v4l2_pix_format type is the same as mplane
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-05-15 22:03:18 +08:00
simbit18 360c2fc44c fix nxstyle
Remove TABs
fix Relative file path does not match actual file.
2024-05-15 21:53:59 +08:00
zhanghongyu 53a72a31fb sys/socket.h: add the definition of SCM_TIMESTAMP.
Third-party library lcm will use SCM_TIMESTAMP macro definition

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-05-15 16:12:10 +08:00
Zhe Weng c234fac910 net/netdev: Check quota when registering lower-half devices
Some drivers may set too big quota by accident and consume all of our
buffers, so we add a check when registering devices.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-05-14 17:43:26 -03:00
meijian 4702a09538 net/netlink: Add RTM preifx notify support
Signed-off-by: meijian <meijian@xiaomi.com>
2024-05-14 10:05:37 -03:00
chao an 66509e490e sched/mqueue: add support of tick based send() and receive()
Add tick based send()/receive() to reduce the cost of time conversion

Signed-off-by: chao an <anchao@lixiang.com>
2024-05-14 00:32:13 +08:00
hujun5 90f9ffc2e8 sched/sched: CONFIG_SCHED_RESUMESCHEDULER macro define error
we removed "select SCHED_RESUMESCHEDULER",
As SCHED_RESUMESCHEDULER is not a necessary feature in SMP,
turning it on by default may affect performance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-05-09 01:39:47 +08:00
Stuart Ianna c4dbabb1bb drivers/devicetree: Add a set of commonly used FDT utilities. 2024-05-09 01:37:11 +08:00
Yanfeng Liu ce8cfde768 nuttx/sched.h: minor revision on comments
This is mainly to align them better.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-08 15:41:28 +08:00
zhanghongyu 908814a575 libc/lib_bzero:Add bzero prototype.
Implement the bzero function as an alternative to macro expansion.

and support gcc FORTIFY_SOURCE features for nuttx libc

This function will use gcc's function
__builtin_dynamic_object_size and __builtin_object_size

Its function is to obtain the size of the object through compilation,
so as to judge whether there are out-of-bounds operations in commonly used functions.
It should be noted that the option -O2 and above is required to enable this function

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-05-07 14:59:05 +02:00
simbit18 0e67a79b94 fix nxstyle
corrected comments in C89 style
2024-05-03 14:15:56 -03:00
Yanfeng Liu 0f5ba00a50 mm/map: revise device mapping functions
This revises vm_map_region() by accepting unaligned paddr, which is
aligned-down before mapping and in-page offset is then added to vaddr
before returning. It also moves vm_map_region() and vm_unmap_region()
to vm_region.c.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-03 23:58:39 +08:00
Jukka Laitinen 9277be2503 Add configuration option for RTL8211F RGMII PHY
Also extend the "struct phy_desc_s" to support for 1GB PHY's, the speed
detection always needs more than one bit.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-05-02 16:30:41 -03:00
yinshengkai b87804c2ba libc/string: replace __builtin_ffsl with inline function
In the gcc-riscv compiler, __builtin_ffs will call ffs, and calling __builtin_ffs in ffs will cause recursion

Change ffs to an inline function, and compile ffs implemented by nuttx by default.
Only call the implementation of nuttx when the compiler cannot provide an ffs implementation.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-04-30 19:47:08 +08:00
Philippe Leduc 3dc6b4c9bd Add basic support for locales in order to C++ streams to build and work for simple cases (POSIX / C locale).
Fix build with C++ GCC toolchain
2024-04-29 17:34:10 +08:00
anjiahao 0040e9a239 drivers/serial:support arm cmsdk drivers
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-04-26 18:42:35 -03:00
Yanfeng Liu 3822d88669 mm/arch: userspace device mapping support
This patch adds definitions to support user space device mappings
that allows devices like frame buffer to be accessible from user
space in kernel mode.

The are mainly two changes:

- in `mm/`:
  added vm_map_region(), vm_unmap_region() for drivers to do
  device mapping easily.
- in `arch/`:
  extended ARCH_SHM_NPAGES as user-space mapping region size.
  decoupled ARCH_SHM_MAXREGIONS from region size calculations and
  limit its usage only for SysV shm purposes.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-04-26 12:11:35 +08:00
zhanghongyu b934555fd1 mm/iob: Support alloc IOB via malloc
Support the network interface card driver to receive zero copies of packets and send and receive giant frame packets, allowing drivers to initialize the DMA buffer to the iob structure, and we can apply for IOB with large memory

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-26 01:06:21 +08:00
zhanghongyu 00d208baf6 mm/iob: replace CONFIG_IOB_BUFSIZE to IOB_BUFSIZE(iob)
Variable length iob can be supported

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-26 01:06:21 +08:00
Zhe Weng 918e38419a netfilter.h: Include <netinet/in.h> for struct in_addr
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-24 08:41:28 +02:00
Zhe Weng 6beb459a43 netfilter: Move IP6T_F to correct file
Ref: https://github.com/torvalds/linux/blob/v6.7/include/uapi/linux/netfilter_ipv6/ip6_tables.h#L91-L95

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-24 08:41:28 +02:00
Juha Niskanen 3348d03f95 libs/libc/inttypes: add support for imaxdiv
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2024-04-23 10:26:48 -03:00
raiden00pl 41803a0c20 sensors/bh1749nuc: add support for the new sensor framework
bh1749nuc can be used with the new sensor framework
2024-04-21 14:48:28 -03:00
dongjiuzhu1 7c4e3aff14 drivers/usbdev/mtp: fix compile break
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:24:40 +08:00
dongjiuzhu1 e7fd416f9f drivers/usbdev: support config pid/vid by soft interface
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:24:40 +08:00
dongjiuzhu1 e5a925543b drivers/usbdev: fix double free when cdcacm uninitialize with not used
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:21:54 +08:00
dongjiuzhu1 ad59ef075f drivers/usbdev: remove first uninitialization and release resouce once.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:21:54 +08:00
dongjiuzhu1 9c55f21a6f drivers/cdcacm/serial: add release interface to release uart_dev resource
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:21:54 +08:00
raiden00pl 5af805b2ef sensors/bmi270: add support for the new sensor framework
bmi270 can be used with the new sensor framework
2024-04-21 19:06:18 +08:00
raiden00pl 3d765616ea sensors/adxl372: add support for the new sensor framework
adxl372 can be used with the new sensor framework
2024-04-21 18:57:33 +08:00
raiden00pl db7c8be61f sensors: add support for bmm150 magnetometer
add support for Bosch BMM150 Magnetometer
2024-04-20 16:20:43 -03:00
raiden00pl ebcf25b2f6 sensors: add support for adxl362 accelerometer
add support for Analog Devices ADXL362 accelerometer
2024-04-20 11:47:50 -03:00
Zhe Weng 3a844d8dd7 net/netlink: Add NETLINK_NETFILTER's CONNTRACK support
Now we only supports conntrack info from NAT entries, to let our apps in user space know the mapping status in NAT.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-04-18 13:03:59 +08:00
Michal Lenc 9798674f27 libc: add support for reallocarray
This commit adds support for reallocarray function. The functionality
is the same as for standard realloc, but the function also checks for
multiplication overflow and fails safely in case it occurs.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-04-17 11:36:39 -03:00
Xiang Xiao 81c8f902b6 video: Move video_format_s from video.h to v4l2_cap.c
since it is only used in v4l2_cap.c.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-04-14 12:08:30 -03:00
Jakub Janousek 23c6b5b07d drivers/spi: Add support for FPGA iCE40 bitstream loading.
Tested on ICE-V-Wireless board.

Signed-off-by: Jakub Janousek <janouja9@fel.cvut.cz>
2024-04-12 10:19:58 -03:00
jianglianfang 62a4799409 video/vnc: add vnc_fb_register
To optimize the initialization of vnc, change it to vnc_fb_register.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-04-12 17:42:49 +08:00
hujun5 638716504d fdcheck: update fdcheck impl
1 store fd in the high position
2 removing the pid information , as the tag information is sufficient.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-04-11 10:45:44 +08:00
ligd 3844efb5b8 stack: update up_get_intstackbase API to support cpu id
For crash dump all the CPU intstack

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-04-09 16:59:00 -03:00