Current timer hardware supports both absolute and relative count timers. Without an absolute count timer interface, setting an alarm timer might incur additional overhead in obtaining the current time, resulting in performance degradation and inaccurate timing.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit introduce new clockdevice interfaces for oneshot.
- It can represent both `timer` and `alarm`.
- It simplifies the implementation of timer driver. Timer driver do not need considering the time conversion between clock count, tick and timespec.
- It sets timer align to the tick boundary to improve timer accuracy.
- It can avoid using 64-bit division during timer expiration interrupt, improves performance and reduces interrupt latency.
- It considers almost all multiplication overflow problems in time conversion without processing at the driver.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Adds a device ID to ee25xx_initialize, which is stored in the
ee25xx_dev_s structure. This ID is used when calling SPI_SELECT.
The implementation is based on the handling of the chip select in
mtd/ramtron.c
This change is NOT backward compatible: the function signature has changed
Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
Adds a device ID to at25ee_initialize, which is stored in the
at25ee_dev_s structure. This ID is used when calling SPI_SELECT.
The implementation is based on the handling of the chip select in
mtd/ramtron.c
This change is NOT backward compatible: the function signature has changed
Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
This commit added the clkcnt abstraction.
Clkcnt is used to abstract the cycle counter of hardware timer, which can represent almost all existing timers. Time conversion through API provided by clkcnt can avoid any timing conversion problem (multiplication overflow, division precision loss, etc.).
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit added support for pure function attributes and compile-time
constant condition.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Make g_system_ticks a static variable, as it is only accessed by
clock_get_sched_ticks().
This change improves code modularity and enhances safety, since
clock_get_sched_ticks() performs proper synchronization when
reading g_system_ticks.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
It acts as register_driver but also populates the inode size.
This allows to return a non-zero size when calling stat() on an eeprom
driver.
The conditions (CONFIG_PSEUDOFS_FILE or CONFIG_FS_SHMFS) for the
declaration of the inode size field have also been removed so that other
drivers can populate this field in the future.
Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
This patch introduces wd_restart_next(), which enables precise and
convenient watchdog restarts upon expiration. It is designed to be
invoked within the watchdog expiration callback to facilitate accurate
periodic events.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Introduce wd_restart() to allow restarting an existing watchdog
with its previously configured callback and argument, making it
easier to refresh or reuse preconfigured watchdog timers.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Move wd_start() to an inline function to reduce function call
overhead and improve performance in time-critical watchdog operations.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
by index or address
- dns_del_nameserver()
- dns_del_nameserver_by_index()
Update the "DNS function" section in 11_network.rst, and create
the netlib API documentation in netlib/index.rst
Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
Use list_in_list() to determine whether a watchdog is active,
eliminating the need to set the watchdog function pointer to NULL
as an indicator of inactivity.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
This flag can be used to store the filename of a loaded module or
executable in binfmt. The filename is useful for example in debugging.
For example, gdb or a jtag debugger can be configured to automatically
fetch the symbols for the currently executing module.
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
The current event implementation relies on a dedicated wait object,
which introduces several issues:
1. Increases memory usage
2. Complicates the event logic
3. Makes the API design less clean, as it requires a separate
nxevent_tickwait_wait() function
This patch removes the event’s dependency on the wait object
and eliminates the nxevent_tickwait_wait() API accordingly.
BREAKING CHANGE: this commit removed the nxevent_tickwait_wait function
so the related docs should be updated accordingly
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
The current event implementation uses semaphores for wait and post
operations. Since semaphores are relatively heavy-weight and intended
for resource-based synchronization, this is suboptimal.
So this patch replaced the semaphore-based mechanism with direct
scheduler operations to improve performance and reduce memory footprint.
This patch also introduce a new task state TSTATE_WAIT_EVENT to indicate
the task is waiting for a event.
BREAKING CHANGE: This commit introduced a new task state TSTATE_WAIT_EVENT
so apps/nshlib/, procfs/ and tools/pynuttx/nxgdb/ are needed to be updated accordingly.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
Restore the use of critical sections to provide mutual exclusion
between event wait and post operations. This allows replacing the
heavier semaphore-based mechanism with direct scheduler operations
for synchronization.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
Introduce early_syslog() to enable basic logging during the very early
boot or system down stages, when the full syslog subsystem is not yet
available.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
Add a new function nxsched_wakeup() to the scheduler,
which allows waking up a sleeping task before its timeout.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
If the compiler optimization is disabled, the stack-usage of inlining functions will not be optimized.
In this case, force inlining can lead to stack-overflow (e.g.
qemu-armeabi-v7a-bl). This commit replaced the definition of the
always_inline_function and inline_function with the inline
keyword to avoid force-inlining.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit provided a better invdiv_u32 implementation on 64-bit architectures. The test results showed it is 25% faster than the original implementation on x86_64.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit implemented optimized runtime-invariant integer division
proposed by T. Granlund and L. Montgomery. It can be used to convert the
hardware clock cycles to seconds, where the clock frequency is runtime-invariant.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Introduce a new function nxsched_tick_expiration() to replace
nxsched_alarm_tick_expiration(). The new function provides a
common implementation that can be shared by both the alarm
and timer architectures.
This change reduces code duplication and provides a unified
function that can be directly reused.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Nuttx currently has 2 types of sleep interfaces:
1. Signal-scheduled sleep: nxsig_sleep() / nxsig_usleep() / nxsig_nanosleep()
Weaknesses:
a. Signal-dependent: The signal-scheduled sleep method is bound to the signal framework, while some driver sleep operations do not depend on signals.
b. Timespec conversion: Signal-scheduled sleep involves timespec conversion, which has a significant impact on performance.
2. Busy sleep: up_mdelay() / up_udelay()
Weaknesses:
a. Does not actively trigger scheduling, occupy the CPU loading.
3. New interfaces: Scheduled sleep: nxsched_sleep() / nxsched_usleep() / nxsched_msleep() / nxsched_ticksleep()
Strengths:
a. Does not depend on the signal framework.
b. Tick-based, without additional computational overhead.
Currently, the Nuttx driver framework extensively uses nxsig_* interfaces. However, the driver does not need to rely on signals or timespec conversion.
Therefore, a new set of APIs is added to reduce dependencies on other modules.
(This PR also aims to make signals optional, further reducing the code size of Nuttx.)
Signed-off-by: chao an <anchao.archer@bytedance.com>
Add a new ioctl to get the count of paninfo
The framebuffer is usually in high-speed RAM. Getting the paninfo
count can help us get the idle state of the framebuffer so that we
can temporarily use this memory.
Signed-off-by: yushuailong1 <yushuailong1@xiaomi.com>
remove reference to non-existent readme in libc.
Pointing to the documentation page doesn't make sense in this case,
because it doesn't explain the use of `#undef XXX` for this case anyway.
Signed-off-by: raiden00pl <raiden00@railab.me>
clock_systime_timespec() always returns 0, so there is no need to
check the return value in the caller code, let us remove the return
value directly.
Signed-off-by: chao an <anchao.archer@bytedance.com>
Supports these Maxim/Analog Devices eeproms with a scratchpad:
DS2430,2431,2432,2433,28E04,28E07,28EC20.
For each type of an eeprom, you create a new driver.
Other than that, the driver is file oriented and supports seeks,
for example.
Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
This commit introduces 2 new fields in the onewire_master_s struct:
uint64_t selected_rom,
uint64_t *available_roms.
The key point behind this is to allow onewire_search to capture all
devices on the bus into the kernel struct. While this commit is keeping
the old API (for the sake of not messing everything up), you don't have
to reimplement the search of all roms in very strange ways
(such as custom callbacks into the userspace).
Instead of that, a generic ioctl (only a function to be called from
the device driver) was implemented, that searches
the bus (for a particular 1wire family), saves it and then copies it
in a standard way to your application. The ioctl is called
ONEWIREIOC_GETFAMILYROMS.
Also as 1wire can interface multiple devices, a API telling the
driver which ROM to interface was missing, this commit fixes
this with the ONEWIREIOC_SETROM call.
The example usage is you first get all the devices on the bus
using ONEWIREIOC_GETFAMILYROMS. In your application, you choose
the correct device you want to talk to. Then you call
ONEWIREIOC_SETROM. And then writes, reads, ...
Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
The wdog implementation redefined `list_node`, which could cause
conflicts or unexpected behavior when both `wdog/wdog.h` and
`list.h` are included in the same source file. This patch removes
the redundant definition to avoid such issues.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>