For resource-constrained devices, simulate RTP
playback effects using preset custom RAMLOOP
combinations instead of using RTP files to play
custom vibration effects.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Some armv7-m-based SoCs do not work with atomic instructions,
even though armv7-m supports them.
To avoid using atomic instructions generated by gcc,
CONFIG_LIBC_ARCH_ATOMIC is newly introduced with which
arch_atomic.c is linked explicitly.
However, the function names need to be changed to avoid
build errors, since the functions described in stdatomic.h
are gcc built-in and inlined when the code is compiled.
Signed-off-by: Takuya Miyasita <Takuya.Miyashita@sony.com>
with greenhills version older than 202354, the __attribute__((naked))
cannot handled by greenhills compiler, and will report warning:
"/home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/arch/arm/src/armv7-m/arm_svcall.c", line 79: warning #1097-D:
unknown attribute "naked"
static void dispatch_syscall(void) naked_function;
^
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
reason:
when CONFIG_CLOCK_TIMEKEEPING=y, compiler error may report
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:42,
from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/arch.h:89,
from boardctl.c:33:
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/irq.h:261:12: error: conflicting types for 'enter_critical_section'; have 'irqstate_t(void)' {aka 'long unsigned int(void)'}
261 | irqstate_t enter_critical_section(void) noinstrument_function;
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/wqueue.h:37,
from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/addrenv.h:39,
from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:40:
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/wdog.h:267:11: note: previous implicit declaration of 'enter_critical_section' with type 'int()'
267 | flags = enter_critical_section();
| ^~~~~~~~~~~~~~~~~~~~~~
hujun5@hujun5-OptiPlex-7070:~/downloads1/vela_sim/nuttx$ make -j12
sched/sched_processtimer.c: In function 'nxsched_process_timer':
sched/sched_processtimer.c:178:3: error: implicit declaration of function 'clock_update_wall_time' [-Werror=implicit-function-declaration]
178 | clock_update_wall_time();
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Usage example for merging the factory partition and reserve
partition into the merge partition:
register_merge_blockdriver("/dev/merge", "/dev/factory", "/dev/reserve",
NULL)
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
reason:
The old implementation of the SMP call, even when using the "no wait" parameter,
could still result in waiting, if invoking it within a critical section
may lead to deadlocks. Therefore, in order to implement a truly asynchronous SMP
call strategy, we have added nxsched_smp_call_async.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Fixes psock_socket: ERROR: socket address family unsupported: 2
When using the minimal CONFIG_NET configuration typically used for
SocketCAN
Update net/inet/inet.h
Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
Update net/inet/inet.h
Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
reason:
We decouple semcount from business logic by using an independent counting variable,
which allows us to remove critical sections in many cases.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Move CONFIG_SEM_PREALLOCHOLDERS to include/semaphore.h to avoid undefined issues from occurring in other places as well.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
This primarily fixes allocated memory overrun due to invalidly
calculated limit of the chunk. The function here allocates chunk of size
that includes required header. The error was that size of the chunk was
invalidly again added when limit was being calculated. This was causing
memory overrun and issues especially with object growing (reallocation).
The secondary fix here is to the algorithm that rounds the required size
to the multiple of chunk size. In short chunk size must be reduced by
one to get the correct mask. The condition that was generating the mask
was also invalid because it must perform shift with at most one less
than number of bits (not bytes).
Summary:
add check !defined(__STDC_NO_ATOMICS__)
If the macro constant __STDC_NO_ATOMICS__(C11) is defined by the compiler, the header <stdatomic.h>, the keyword _Atomic, and all of the names listed here are not provided.
refer to:https://en.cppreference.com/w/c/atomic
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
currently, nuttx implements readv/writev on the top of read/write.
while it might work for the simplest cases, it's broken by design.
for example, it's impossible to make it work correctly for files
which need to preserve data boundaries without allocating a single
contiguous buffer. (udp socket, some character devices, etc)
this change is a start of the migration to a better design.
that is, implement read/write on the top of readv/writev.
to avoid a single huge change, following things will NOT be done in
this commit:
* fix actual bugs caused by the original readv-based-on-read design.
(cf. https://github.com/apache/nuttx/pull/12674)
* adapt filesystems/drivers to actually benefit from the new interface.
(except a few trivial examples)
* eventually retire the old interface.
* retire read/write syscalls. implement them in libc instead.
* pread/pwrite/preadv/pwritev (except the introduction of struct uio,
which is a preparation to back these variations with the new
interface.)
adapts to third-party code compilation. in the process of porting EtherCAT,
we encounter some situations where the structure is not defined, or the
returned data types do not match the expectations. Refer to the EtherCAT
implementation of other systems and add relevant definitions.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This reverts commit 908814a575.
In macos, memset will be automatic optmize to bzero, caused dead loop, as we not using bzero, macro re-define should ablt to cover the requirements.
Signed-off-by: buxiasen <buxiasen@gmail.com>
from ServiceManager.cpp:17:
/home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/ndk/include_cpp/android/binder_to_string.h:71:24: error: expected nested-name-specifier before numeric constant
71 | template <typename _U>
| ^~
/home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/ndk/include_cpp/android/binder_to_string.h:71:24: error: expected ‘>’ before numeric constant
In file included from /home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/aidl/android/os/ConnectionInfo.h:3,
from /home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/aidl/android/os/IServiceManager.h:3,
from /home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/aidl/android/os/BnServiceManager.h:4:
/home/ligd/platform/dev/apps/external/android/frameworks/native/libs/binder/ndk/include_cpp/android/binder_to_string.h:72:56: error: no matching function for call to ‘declval<1>()’
72 | static auto _test(int) -> decltype(std::declval<_U>().toString(), std::true_type());
| ~~~~~~~~~~~~~~~~^~
In file included from /home/ligd/platform/dev/nuttx/include/libcxx/__type_traits/is_convertible.h:18,
Signed-off-by: ligd <liguiding1@xiaomi.com>
/data/project/code/apache/nuttx/include/nuttx/rpmsg/rpmsg_virtio.h:176:28: error: field ‘rsc_tbl_hdr’ has incomplete type
176 | struct resource_table rsc_tbl_hdr;
| ^~~~~~~~~~~
/data/project/code/apache/nuttx/include/nuttx/rpmsg/rpmsg_virtio.h:178:28: error: field ‘log_trace’ has incomplete type
178 | struct fw_rsc_trace log_trace;
| ^~~~~~~~~
/data/project/code/apache/nuttx/include/nuttx/rpmsg/rpmsg_virtio.h:179:28: error: field ‘rpmsg_vdev’ has incomplete type
179 | struct fw_rsc_vdev rpmsg_vdev;
| ^~~~~~~~~~
/data/project/code/apache/nuttx/include/nuttx/rpmsg/rpmsg_virtio.h:180:28: error: field ‘rpmsg_vring0’ has incomplete type
180 | struct fw_rsc_vdev_vring rpmsg_vring0;
| ^~~~~~~~~~~~
/data/project/code/apache/nuttx/include/nuttx/rpmsg/rpmsg_virtio.h:181:28: error: field ‘rpmsg_vring1’ has incomplete type
181 | struct fw_rsc_vdev_vring rpmsg_vring1;
| ^~~~~~~~~~~~
/data/project/code/apache/nuttx/include/nuttx/rpmsg/rpmsg_virtio.h:182:28: error: field ‘config’ has incomplete type
182 | struct fw_rsc_config config;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
that pr requires chip turn on CONFIG_DRIVERS_BLUETOOTH to use bluetooth,
but not all defconig enable this option, so let's map bt_driver_register
to bt_netdev_register in header file in this case, and revert the unnessary
change in the related chip and board folders.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
add bt_driver_register interface, which could handle
these cases:bth4 bth5 btbridge btslip and btuart_lowerhalf_s etc.
Signed-off-by: chengkai <chengkai@xiaomi.com>
add btuart_create interface, which would be more
flexible in complex cases. And extract btuart_register interface.
Signed-off-by: chengkai <chengkai@xiaomi.com>
when downloading rtk firmware with vendor hci cmd sending to
bt bridge, which would not filter that hci cmd.
Signed-off-by: chengkai <chengkai@xiaomi.com>
This implements empty hooks to the arch/chip layer, which can implement
an optional translation between logical<->physical CPU/core id.
The default mapping is 1:1 i.e. logical=physical.
Current 8 bits of uint8_t cannot represent sample rate bigger than
255,change uint8_t to uint32_t to expand sample rate range.
Signed-off-by: wurui3 <wurui3@xiaomi.com>
In the previous design, this member may be cleared or not cleared,
which results in the API's side effects not being a clear property.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Configuration/Tool: teensy-2.0/nsh
In file included from
/github/workspace/sources/nuttx/include/nuttx/coredump.h:35:0,
from
/github/workspace/sources/nuttx/sched/misc/coredump.h:28,
from ./init/nx_bringup.c:54:
/github/workspace/sources/nuttx/include/nuttx/elf.h:31:22: fatal error:
arch/elf.h: No such file or directory
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
reason:
We can utilize percpu storage to hold information about the
current running task. If we intend to implement this feature, we would
need to define two macros that help us manage this percpu information
effectively.
up_this_task: This macro is designed to read the contents of the percpu
register to retrieve information about the current
running task.This allows us to quickly access
task-specific data without having to disable interrupts,
access global variables and obtain the current cpu index.
up_update_task: This macro is responsible for updating the contents of
the percpu register.It is typically called during
initialization or when a context switch occurs to ensure
that the percpu register reflects the information of the
newly running task.
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ 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>
1. optimize the macro, add () for the marco arguments;
2. add pci_write_mmio_qword() and pci_read_mmio_qword() api;
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
ivshmem based driver can use this api to judge weather current
ivshmem device support irq or not, and use polling mode or irq
mode to process the event.
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
developers must be careful to hold spinlocks and ensure all
of protected code is under control, so remove support for nested
spinlocks to improve performance.
Signed-off-by: chao an <anchao@lixiang.com>
1. add IS_ALIGNED() definitions for NuttX;
2. replace all the ALIGN_UP() and ALIGN_DOWN() to use common
align implementation;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Use bit mask method to represent the command, because it's more
convenient to express multiple characteristics simultaneously.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
In some cases, we only need to use INSTRUMENTATION_DUMP to record custom data,
and we don't want the thread start and end information
Move this part to INSTRUMENTATION_SWTICH for recording
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
According to the standard definition, assert should return a void expression
https://pubs.opengroup.org/onlinepubs/007904875/basedefs/assert.h.html
This patch involves two changes:
If you define the NDEBUG macro, assert does not use any parameters and directly returns a void expression.
assert should return a void expression and cannot use do-while statements.
If the following code , a compilation error will occur.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
When using alarm_arch implementation, 64-bit time can be returned. Using unsign long will cause precision loss.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
gprof can analyze code hot spots based on scheduled sampling.
After adding the "-pg" parameter when compiling, you can view the code call graph.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Some app with same code runs on different cores in AMP mode,
need the physical core on which the function is called.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
1. Use critical_section to protect the fds array;
2. Use critical_section and sched lock to protect the poll notify, because
poll notify may cause context switch, delay the context swtich to
sched_unlock();
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
These two macros can be called in interrupt context and:
1. Do nothing when called in interrupt;
2. Same behavior as sched_lock/unlock when called in thread;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
And remove the virtio_alloc/free_buf implementation in virtio.c, because
these two apis has been moved to the OpenAMP
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Do not format immediately when calling sched_note_printf, but delay formatting until dump trace.
After turning on SYSTEM_NOTE, similar asynchronous syslog functions can be achieved.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Some app with same code runs on different cores in AMP mode,
need known physical core id on which the function is called.
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>