Commit Graph

240 Commits

Author SHA1 Message Date
Xiang Xiao 11b3adf17f drivers/rtc/rpmsg: Move clock_synchronize rpmsg_rtc_server_settime
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-20 13:28:09 +01:00
Xiang Xiao 67bff06a24 drivers/rtc: Skip clock_synchronize if settime return positive value
so driver implementer could call clock_synchronize by self

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-20 13:28:09 +01:00
Xiang Xiao e6ebcb62b1 drivers/rtc: Return -ENOTTY if lower half doesn't implement the corresponding callback
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-20 13:28:09 +01:00
Petteri Aimonen 1825f9534c adjtime: Rewrite implementation to work for RTC and tickless kernel
Previous adjtime() implementation was limited to adjusting system
timer tick period. This commit reimplements the internals to use
a kernel watchdog timer. Platform-independent part of the code now
works also for adjusting hires RTC and tickless timer rate.

User code facing API is unchanged. Architecture code API has changed:
up_adj_timer_period() is replaced by up_adjtime().

Other improvements:

- Support query of remaining adjustment by passing NULL to first
  argument of adjtime(). This matches Linux behavior.

- Improve resolution available for architecture driver, previously
  limited to 1 microsecond per tick. Now 1 nanosecond per second.
2023-11-14 19:47:40 -08:00
raiden00pl b565e28da3 Kconfigs: rename {Rpmsg|rpmsg} to RPMGS 2023-10-28 13:58:56 +08:00
Petro Karashchenko dbc37a0165 nuttx: fix nxstyle issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
yinshengkai 15f88804ca drivers/alarm: modify the default precision of up_perf_gettime to ns
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-09-08 01:09:02 +03:00
zhangyuan21 aa9f15d635 arch_alarm: change tick to g_current_tick
When the system starts up, the hw count may not start counting from 0,
which can cause the processing time of the first oneshot handler to be
too long. Therefore, the current tick value should be set based on the
hw count during initialization.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-06 17:28:26 +08:00
Jukka Laitinen 7ec3cad5af drivers/timers/pcf85263.c: Fix compilation
Add the missing semicolons

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-09-06 12:20:57 +08:00
chao an 664927c86e mm/alloc: remove all unnecessary cast for alloc
Fix the minor style issue and remove unnecessary cast

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-30 14:34:20 +08:00
chao an b60f01a55b inode/i_private: remove all unnecessary cast for i_private
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 08:58:07 +02:00
chao an 7aa45305b7 fs/inode: remove all unnecessary check for filep/inode
Since VFS layer already contains sanity checks, so remove unnecessary lower half checks

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 09:47:11 +08:00
Michal Lenc 00128ff2fe pwm: fix incorrect documentation for PWMIOC_SETCHARACTERISTICS IOCTL
Documentation for PWMIOC_SETCHARACTERISTICS ioctl command mentioned
that this command will neither start nor stop the pulsed output. This
however is incorrect as PWMIOC_SETCHARACTERISTICS command leads to
pwm_start() function which starts the pulsed output.

While this might not be the correct behaviour (I would probably welcome
the option to set PWM characteristics without starting the pulsed output)
it is the way the PWM driver is coded for many architectures. Future
enhancement might be to add function pwm_setchar() for example to just
set characteristics without starting the PWM output.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-08-24 01:37:40 +08:00
xucheng5 417207678e driver/capture : add capture debug, fixed compile warning
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-08-18 09:21:46 +02:00
xuxin19 f2f0d7fbad cmake:fix drivers build block during cmake reforming
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-16 22:38:52 +08:00
wangming9 c928acc9ff perf: The new configuration supports hardware performance counting
Adding the CONFIG_ARCH_PERF_EVENTS configuration to enable
hardware performance counting,solve the problem that some platform
hardware counting support is not perfect, you can choose to use
software interface.

This is configured using CONFIG_ARCH_PERF_EVENTS, so weak_functions
are removed to prevent confusion

To use hardware performance counting, must:
1. Configure CONFIG_ARCH_PERF_EVENTS, default selection
2. Call up_perf_init for initialization

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-08-12 02:20:44 +08:00
Petro Karashchenko 1b0baa8337 nuttx: use lib_free for memory de-allocation after strdup or asprintf
The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
yangguangcai 05af311e68 qemu:add qemu rtc driver.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2023-08-02 03:27:55 -07:00
Bowen Wang 835a2a8801 watchdog: add CONFIG_WATCHDOG_PANIC_NOTIFIER for panic notifier
wdog_notifier() will be called in _assert to keep the crash scene
as mush as possible, which is useful for debug.

But once disable the watchdog, the hardware watchdog can not reboot
the system too. If a crash happened in the _assert (e.g. the tcb sp
has been corrupted, system will crash again in tack stack dump),
system will crashing forever and can not reboot.

So add a config to disable this feature by default and can be enable
if anyone need it.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-07-31 14:45:18 +02:00
chao an ee6e2ce149 arch/perf: add ARCH_HAVE_PERF_EVENTS to support hardware perf events
The implementation of up_perf_*() is in a different static library in nuttx:

Hardware: libarch.a
Software: libdrivers.a (weak function)

Since functions with weak attributes cannot be correctly replaced in multiple static libraries,
this PR will use macros to replace whether the arch supports hardware perf events

Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-21 20:43:30 +08:00
yinshengkai 81553deb53 time: add up_perf_init weak_function
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-11 10:09:25 -03:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
simbit18 e4ffce3355 Fix Kconfig style
Remove spaces from Kconfig files
2023-05-23 00:03:25 +08:00
Fotis Panagiotopoulos 4231938892 rtc: Fix compiler warning in driver initialization. 2023-05-11 22:18:10 +03:00
Xiang Xiao 51dc67ad5f fs: Add g_ prefix for all global file_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
wangming9 a7fc26124d arch/arm64: the arm64 perf interface supports pmu
Summary:
- Support arm64 pmu api, Currently only the cycle counter function is supported.
- Using ARM64 PMU hardware capability to implement perf interface, modify all
  perf interface related code.
- Support for pmu init under smp.

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-04-10 16:23:49 -03:00
zhangyuan21 443c4c46b0 arch_timer: fixed build issue when enable tickless
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-03-15 11:52:52 +01:00
Michal Lenc 88f3d89920 pwm: add configuration option for dead time generators
PWM drivers usually supports dead time generators that automatically
insert output activation delay for complementary PWM outputs. This
is usefull for some control purposes as control of H bridge for example.

This commit adds an application to driver interface that can be used
to set up those delays (if supported by the selected architecture)
directly from the application. The set up remains the same as for duty
cycle value.

The whole addition is by default disabled. It can be enabled by config
option PWM_DEADTIME.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-03-07 01:30:01 +08:00
Michal Lenc 333707e101 pwm: add PWM overwrite under CONFIG_PWM_OVERWRITE option
Generic drivers shoud not use architecture related config options like
CONFIG_SAMV7_PWM. This commit adds PWM pin overwrite under generic
configuration option CONFIG_PWM_OVERWRITE.

Now the overwrite can be used on other architectures as well or can be
completely disabled for SAMv7.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-02-19 00:16:41 +08:00
Fotis Panagiotopoulos 85ceb7920e Typo fixes. 2023-02-17 11:17:11 -03:00
chao an 4c8d244fae sched/getpid: replace syscall getpid/tid/ppid() to kernel version
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
anjiahao 52eaefcc8e watchdog:fix Kconfig typo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-02-01 19:50:47 +08:00
Xiang Xiao 004853d6d1 drivers/watchdog: Fix the wrong value of WATCHDOG_AUTOMONITOR_PING_INTERVAL
if CONFIG_WATCHDOG_AUTOMONITOR_PING_INTERVAL equals 0, we should set
WATCHDOG_AUTOMONITOR_PING_INTERVAL to CONFIG_WATCHDOG_AUTOMONITOR_TIMEOUT / 2, not 0

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-31 11:54:36 +08:00
anjiahao 6f2f62f4ce watchdog:fix Kconfig typo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-30 15:49:50 +01:00
anjiahao 96ec6983db watchdog:use 'V' to stop watchdog
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-06 20:02:26 +08:00
anjiahao 5e878186c7 watchdog:add a callback when painc stop the watchdog
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-06 10:42:37 +08:00
Xiang Xiao b0a0ba3ad7 fs: Move mmap callback before truncate in [file|mountpt]_operations
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02:00
Xiang Xiao 779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Jukka Laitinen f33dc4df3f Change FIOC_MMAP into file operation call
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen 41e9df2f3e Add ftruncate into file operation calls
- Add truncate into file_operations
- Move truncate to be common for mountpt_operations and file_operations
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
zhangyuan21 9150ea0e95 arch_alarm: don't init local variable for fpu test case fail
D16 register will be cleared when compiling with gcc on some boards.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-07 12:21:16 +08:00
zhangyuan21 b118083c35 arch_timer: adjust timer/arch_timer to support tick
Enable CONFIG_SCHED_TICKLESS_TICK_ARGUMENT in tickless mode
to improve the performance.
2022-11-01 21:53:08 +08:00
liuxuanfu 29be2481e9 drivers/timers/capture: Fix mutual exclusion lock 2022-10-27 19:10:16 +08:00
anjiahao 5724c6b2e4 sem:remove sem default protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
zhangyuan21 fc9b5e1980 arch_alarm: adjust oneshot/arch_alarm to support tick 2022-10-12 11:55:46 +08:00
zhangyuan21 750007ded9 sched: use tick count for sched timer expiration 2022-10-12 11:55:46 +08:00
Xiang Xiao ba20cadd65 watchdog: Add help description for each keep alive method
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 22:04:36 +02:00
Xiang Xiao 665e05ec48 watchdog: Change WATCHDOG_AUTOMONITOR_PING_INTERVAL default to zero
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 22:04:36 +02:00
Xiang Xiao 03f45a124a watchdog: Support auto monitor keep alive from oneshot lowerhalf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 22:04:36 +02:00