This is a tool for associating discrete IDs with addresses.
This tool is implemented through the red-black tree method provided by <sys/tree.h>, and the time complexity when calling, searching, and deleting is optimized to O(logn)
The implementation is the moving node operation of two red-black trees
1. When applying for a node, it will first check whether there is an available node in the "removed" tree. If so, the memory address of the node will be reused and moved to the "alloced" tree.
2. If the "removed" tree is an "empty tree", then the node will be requested from the memory and added to the "alloced" tree
3. Similarly, when removing a node, we set the address pointed to in the node to "NULL" and move it to the "removed" tree. Next time we alloc the node, we can reduce the overhead caused by memory application
For now, we still have something that can be optimized, and that is the memory elimination mechanism of the "removed tree". The current implementation will only release all the content under the "removed" tree when the idtree is destroyed.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
According to the eMMC specification, in Backwards Compatibility
with legacy MMC card mode, the frequency of the SD clock must be
0-26 MHZ; in high speed SDR mode, it must be 0-52MHZ. So we should
switch to high speed SDR mode if the clock frequency is higher than
26MHZ.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
solve the compiling problem of the third-party library,
add IN6_IS_ADDR_MC_LINKLOCAL and IN6_IS_ADDR_SITELOCAL definitions.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
"libcxxmini/libxx_cxa_guard.cxx", line 47: error #77-D: this declaration has
no storage class or type specifier
__extension__ typedef int __guard __attribute__((mode(__DI__)));
^
"libcxxmini/libxx_cxa_guard.cxx", line 47: error #65: expected a ";"
__extension__ typedef int __guard __attribute__((mode(__DI__)));
^
"libcxxmini/libxx_cxa_guard.cxx", line 64: error #20: identifier "__guard" is
undefined
int __cxa_guard_acquire(FAR __guard *g)
^
"libcxxmini/libxx_cxa_guard.cxx", line 64: error #20: identifier "g" is
undefined
int __cxa_guard_acquire(FAR __guard *g)
^
"libcxxmini/libxx_cxa_guard.cxx", line 65: error #65: expected a ";"
{
^
"libcxxmini/libxx_cxa_guard.cxx", line 93: warning #12-D: parsing restarts
here after previous syntax error
}
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
CC: src/algslib_sha256.c "comlin.c", line 189: error #1982-D: target stack alignment is insufficient to
guarantee alignment of this variable
struct can_frame lin_err_frame = comlin_rx_frame[chlId];
^
"comlin.c", line 282: error #1982-D: target stack alignment is insufficient to
guarantee alignment of this variable
struct can_frame frame;
^
"comlin.c", line 321: error #1982-D: target stack alignment is insufficient to
guarantee alignment of this variable
struct can_frame frame;
"DiagServer_IsoTp.c", line 220: error #1982-D: target stack alignment is
insufficient to guarantee alignment of this variable
struct canfd_frame frame = {0};
^
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
the mempool_alloc and mempool_free function are duplicate with the
mempool method that provided in optee_os, in order to port optee_os, so
we rename the mempool related functions in nuttx
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
In order to better use the Android goldfish emulator,
a GPU FB driver has been added. This allows the goldfish
emulator side to achieve more flexible display effects,
such as UI skins.
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
According to Virtual I/O Spec:
When using legacy interfaces, transitional drivers which have not negotiated VIRTIO_F_ANY_LAYOUT MUST use a single descriptor for the struct virtio_net_hdr on both transmit and receive, with the network data in the following descriptors.
https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2280006 (Section 5.1.6.6)
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
stdint.h is needed in uart_16550.h for some types, e.g. uint32_t,
uintptr_t. Otherwise there will be building issue unless that stdint.h
is added before uart_16550.h by all files which needs uart_16550.h.
Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
warning C5101: use of preprocessor directive in function-like macro argument list is undefined behavior
Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
Refactoring path logic to prevent logic flaws, direntry size bug fix to allow proper direntry traversal, open free bug fix to prevent memory leak after close.
Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
This adds explicit `void mm_free_delaylist(heap)` interface so that
to force freeing the heap's delaylist.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
when the thread to backtrace is exiting, get_tcb and up_backtrace in
different critical section may cause try to dump invalid pointer, have
to ensure the nxsched_get_tcb and up_backtrace inside same critical
section procedure.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This driver implements `read`, `write`, `open`, `close` and `ioctl`
interfaces to the SHT4X temperature and humidity sensor on an I2C bus.
The read implementation is that of a character driver for easy
debugging, while `ioctl` provides an interface to the sensor's raw data
collection and heating functionality.
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h: In function 'bool spin_trylock_wo_note(volatile spinlock_t*)':
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:401:22: error: 'atomic_ushort' was not declared in this scope; did you mean 'std::__1::atomic_ushort'?
401 | atomic_load((FAR atomic_ushort *)&lock->tickets.next);
| ^~~~~~~~~~~~~
| std::__1::atomic_ushort
/home/hujun5/downloads1/vela_sim/nuttx/include/libcxx/__atomic/aliases.h:33:7: note: 'std::__1::atomic_ushort' declared here
33 | using atomic_ushort = atomic<unsigned short>;
| ^~~~~~~~~~~~~
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:401:37: error: expected primary-expression before ')' token
401 | atomic_load((FAR atomic_ushort *)&lock->tickets.next);
| ^
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:410:14: error: expected unqualified-id before 'new'
410 | spinlock_t new =
| ^~~
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:417:44: error: 'atomic_uint' was not declared in this scope; did you mean 'std::__1::atomic_uint'?
417 | if (!atomic_compare_exchange_strong((FAR atomic_uint *)&lock->value,
| ^~~~~~~~~~~
| std::__1::atomic_uint
/home/hujun5/downloads1/vela_sim/nuttx/include/libcxx/__atomic/aliases.h:35:7: note: 'std::__1::atomic_uint' declared here
35 | using atomic_uint = atomic<unsigned int>;
| ^~~~~~~~~~~
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:417:57: error: expected primary-expression before ')' token
417 | if (!atomic_compare_exchange_strong((FAR atomic_uint *)&lock->value,
| ^
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:418:54: error: expected type-specifier before '.' token
418 | &old.value, new.value))
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Original documentation link for riscv is broken,
so update to the correct link for all architectures.
Put the link around `reg_off` to avoid the long line warning
from nxstyle.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
- use 'lan9250_ioctl' to set and get the value of lan9250 phy register
- use `lan9250_uninitialize` to un-initialize the ethernet driver
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
This definition was added in order to solve some compilation problems
encountered when porting tripartite libraries
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>