1
0
Fork 0
forked from nuttx/nuttx-update
Commit graph

6725 commits

Author SHA1 Message Date
YAMAMOTO Takashi
761ee81956 move readv/writev to the kernel
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.)
2024-10-30 17:07:54 +08:00
Xiang Xiao
32784b0898 libc: Refine the arc4random_buf implementation
fill the buffer with getrandom instead random pool
and move the implementation to from crypto to libc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-26 18:04:21 -03:00
chao an
c6591c0f49 driver/serial: remove return value of up_putc()
modify the prototype of up_putc(): remove the return value

The architecture code does not care about the return value of up_putc(), so removing it saves two statements:

Before:                                                    After:
de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)    |  de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)
de50: e24dd014  sub sp, sp, #20                         |  de50: e24dd014  sub sp, sp, #20
de54: e58d0004  str r0, [sp, #4]                        |  de54: e58d0004  str r0, [sp, #4]
de58: e30030f8  movw  r3, #248  @ 0xf8                  |  de58: e30030f8  movw  r3, #248  @ 0xf8
de5c: e3423000  movt  r3, #8192 @ 0x2000                |  de5c: e3423000  movt  r3, #8192 @ 0x2000
de60: e58d300c  str r3, [sp, #12]                       |  de60: e58d300c  str r3, [sp, #12]
de64: e59d1004  ldr r1, [sp, #4]                        |  de64: e59d1004  ldr r1, [sp, #4]
de68: e59d000c  ldr r0, [sp, #12]                       |  de68: e59d000c  ldr r0, [sp, #12]
de6c: ebfffe66  bl  d80c <pl011_putc>                   |  de6c: ebfffe66  bl  d80c <pl011_putc>
de70: e59d3004  ldr r3, [sp, #4]                        |  de70: e28dd014  add sp, sp, #20
de74: e1a00003  mov r0, r3                              |  de74: e49df004  pop {pc}    @ (ldr pc, [sp], #4)
de78: e28dd014  add sp, sp, #20                         |
de7c: e49df004  pop {pc}    @ (ldr pc, [sp], #4)        |

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-26 13:21:29 +08:00
Tim Hardisty
bc0f90659f Fix cdcncm printf formatter compiler warning 2024-10-25 00:52:29 +08:00
zhangshoukui
1af82ba979 mmcsd: SDIO_CAPS_4BIT_ONLY set buswidth MMCSD_SCR_BUSWIDTH_4BIT
uint8_t buswidth:4;              /* Bus widths supported (SD only) */

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-24 18:06:22 +08:00
anjiahao
f307c1587c serial/gdbstub:Adjust serial port gdbstub Kconfig dependencies
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-24 08:45:21 +08:00
Ville Juven
7a137f0353 syslog: Don't allow blocking when in signal handler
Blocking while running a signal handler is not advisable, instead write
the log string character by character.

There is also a potential for a deadlock, as discussed in #6618

Note: querying for rtcb->sigdeliver is not 100% ideal, as it only tells
_if_ a signal handler has been queued, not if it is running. However, it
makes syslog safe / usable which is a debug feature anyhow.
2024-10-23 21:14:44 +08:00
ligd
662bbeb33e container_of: fix compile failed cause of list.h not support container_of
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 20:10:43 +08:00
ligd
4845b9e6e5 bluetooth: fix bt missing header files nuttx/wqueue.h
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 20:10:43 +08:00
Jukka Laitinen
1a267dc62d drivers/timers/arch_alarm.c: Remove ndelay_accurate
Using ONESHOT_CURRENT retrieves the tick number multiplied by tick time; thus
it doesn't give the accurate monotonic time - it is quantized by
the tick time. This cannot be used as a ndelay timer, it would always loop
at least to the end of the ongoing tick.

Revert the up_udelay to use the original "coarse" looping. The "accurate" udelay,
if such is needed, should either be done under arch specific code, or there should be
a function for getting the accurate time that is available for all the platforms.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-23 14:28:18 +08:00
simbit18
a5f8dfdae0 Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2024-10-22 23:20:46 +08:00
Matteo Golin
bbc95d70db adc: Implement ADC driver interface for MCP3008 over SPI. Includes documentation page for the driver, and inclusion of driver registration code for RP2040-based boards. 2024-10-22 13:56:23 +08:00
Bowen Wang
71fe4acef4 MacOs: fix the sim compile warning in MacOS
CC:  clk/clk_fixed_rate.c clk/clk_divider.c:177:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
             ^
clk/clk_divider.c:177:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
             ^~~
clk/clk_divider.c:177:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
                               ^
clk/clk_divider.c:177:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
                               ^~~
CC:  mm_heap/mm_initialize.c 2 warnings generated.
clk/clk.c:1324:11: warning: variable 'irqflags' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      if (clk->parents == NULL)
          ^~~~~~~~~~~~~~~~~~~~
clk/clk.c:1341:19: note: uninitialized use occurs here
  clk_list_unlock(irqflags);
                  ^~~~~~~~
clk/clk.c:1324:7: note: remove the 'if' if its condition is always false
      if (clk->parents == NULL)
      ^~~~~~~~~~~~~~~~~~~~~~~~~
clk/clk.c:1255:22: note: initialize the variable 'irqflags' to silence this warning
  irqstate_t irqflags;
                     ^
                      = 0
CC:  clk/clk_mux.c clk/clk_multiplier.c:110:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
             ^
clk/clk_multiplier.c:110:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
             ^~~
clk/clk_multiplier.c:110:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
                               ^
clk/clk_multiplier.c:110:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
                               ^~~
clk/clk_mux.c:47:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
             ^
clk/clk_mux.c:47:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
             ^~~
clk/clk_mux.c:47:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
                               ^
clk/clk_mux.c:47:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
                               ^~~
AS:  sim/sim_fork_x86.S 2 warnings generated.
1 warning2 warnings generated.
 generated.
iperf.c:325:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'unsigned long' [-Wformat]
             now_len -last_len,
             ^~~~~~~~~~~~~~~~~
iperf.c:340:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
             now_len,
             ^~~~~~~
CC:  misc/rpmsgblk_server.c 2 warnings generated.
:28: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                           (uintmax_t)skip);
                           ^~~~~~~~~~~~~~~
nsh_dbgcmds.c:473:20: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                   (uintmax_t)position);
                   ^~~~~~~~~~~~~~~~~~~
CC:  nsh_main.c 2 warnings generated.

              return INTMAX_MIN;
              ~~~~~~ ^~~~~~~~~~
CC:  nsh_system.c  note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:103:37: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from -9223372036854775808 to 0 [-Wconstant-conversion]
          return (accum == limit) ? INTMAX_MIN : -(intmax_t)accum;
          ~~~~~~                    ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:136:29: note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:106:17: warning: result of comparison of constant 9223372036854775807 with expression of type 'uintmax_t' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare]
      if (accum > INTMAX_MAX)
          ~~~~~ ^ ~~~~~~~~~~
inttypes/lib_strtoimax.c:109:18: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
          return INTMAX_MAX;
          ~~~~~~ ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:137:29: note: expanded from macro 'INTMAX_MAX'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:66:29: note: expanded from macro 'INT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:35:23: note: expanded from macro 'INT64_C'
                      ^~~~~~~
<scratch space>:12:1: note: expanded from here
9223372036854775807ll
^~~~~~~~~~~~~~~~~~~~~
syslog/vsyslog.c:212:32: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                             , (uintmax_t)ts.tv_sec
                               ^~~~~~~~~~~~~~~~~~~~
CC:  iob/iob_free.c 4 warnings generated.
1 warning generated.
CC:  mqueue/mq_msgqalloc.c inttypes/lib_strtoumax.c:91:23: warning: implicit conversion from 'unsigned long long' to 'uintmax_t' (aka 'unsigned long') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
              accum = UINTMAX_MAX;
                    ~ ^~~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:140:29: note: expanded from macro 'UINTMAX_MAX'
                            ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:67:29: note: expanded from macro 'UINT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:36:23: note: expanded from macro 'UINT64_C'
                      ^~~~~~~~
<scratch space>:8:1: note: expanded from here
18446744073709551615ull
^~~~~~~~~~~~~~~~~~~~~~~
CC:  icmp/icmp_ioctl.c 1 warning generated.
time/lib_strftime.c:584:52: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
               len = snprintf(dest, chleft, "%ju", (uintmax_t)mktime(&tmp));
                                             ~~~   ^~~~~~~~~~~~~~~~~~~~~~~
                                             %ju

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-22 08:55:57 +08:00
Bowen Wang
320b1b8011 rpmsg_virtio: move notify_wait_cb to struct rpmsg_virtio_device
notify_wait_cb has been moved to struct rpmsg_virtio_device, so
change rpmsg_virtio.c transport too.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-22 08:55:57 +08:00
buxiasen
ed14c1d3a6 rpmsg/virtio: fix compile issue, feature uint32_t to uint64_t
Has change the virtio feature bit to 64bit, so rpmsg virtio need
change to 64bit too.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-22 08:55:57 +08:00
yangsong8
e00fbc5557 syslog: enable LF to CRLF config as default
This commit fixes the issue #14418

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-21 10:50:36 +02:00
Xiang Xiao
8c882cb790 ramlog: Remove RAMLOG_CRLF config and related code
since the conversion is moved to common layer after:
https://github.com/apache/nuttx/pull/14362

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-21 16:27:35 +08:00
yezhonghui
317d7a7f59 Fix make warn as error in pci drivers
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-10-21 15:35:39 +08:00
wanggang26
adc52bf968 syslog: fix ramlog not work issue with cmake
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-19 12:37:07 +02:00
chao an
68d6b18f9a drivers/misc/devmem: add dev_mem.c into cmake build
Signed-off-by: chao an <anchao@lixiang.com>
2024-10-18 21:32:48 +08:00
chao an
11af0e476f drivers/misc/devmem: remove unnecessary register parser
Signed-off-by: chao an <anchao@lixiang.com>
2024-10-18 21:32:48 +08:00
zhangshoukui
a7f7afe019 bmi160: fix Parameter passing error when use spi
nuttx/drivers/sensors/bmi160_uorb.c:596:18: warning: passing argument 1 of ‘bmi160_getreg8’ from incompatible pointer type [-Wincompatible-pointer-types]
  596 |   bmi160_getreg8(priv, 0x7f);
      |                  ^~~~
      |                  |
      |                  struct bmi160_dev_uorb_s *
In file included from nuttx/drivers/sensors/bmi160_uorb.c:25:
nuttx/drivers/sensors/bmi160_base.h:235:49: note: expected ‘struct bmi160_dev_s *’ but argument is of type ‘struct bmi160_dev_uorb_s *’
  235 | uint8_t bmi160_getreg8(FAR struct bmi160_dev_s *priv, uint8_t regaddr);
      |                            ~~~~~~~~~~~~~~~~~~~~~^~~~
nuttx/drivers/sensors/bmi160_uorb.c:597:18: warning: passing argument 1 of ‘bmi160_getreg8’ from incompatible pointer type [-Wincompatible-pointer-types]
  597 |   bmi160_getreg8(priv, 0x7f); /* workaround: fail to switch SPI, run twice */
      |                  ^~~~
      |                  |
      |                  struct bmi160_dev_uorb_s *

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-18 19:58:22 +08:00
zhangshoukui
50f16c840c bmi160: fix compile warning and %zu replace %u
VELAPLATFO-45270

nuttx/drivers/sensors/bmi160.c: In function ‘bmi160_set_normal_imu’:
nuttx/drivers/sensors/bmi160.c:79:3: warning: implicit declaration of function ‘up_mdelay’ [-Wimplicit-function-declaration]
   79 |   up_mdelay(30);
      |   ^~~~~~~~~

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-18 19:58:22 +08:00
lipengfei28
e259aba31c fix build error shift-count-overflow
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-18 17:23:41 +08:00
Xiang Xiao
24cb8c25ab bluetooth: Fix the incompatibility made by https://github.com/apache/nuttx/pull/14224
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>
2024-10-18 09:05:54 +08:00
jihandong
d802912cba nuttx ai driver update
Signed-off-by: jihandong <jihandong@xiaomi.com>
2024-10-17 22:35:40 +08:00
chengkai
6aeb2e2996 Add space before error, bt_driver_register_internal not trigger error, add defconfig DRIVERS_BLUETOOTH.
Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
fangzhenwei
d97b715e5c drivers: append bt_driver.c to bluetooth drivers Cmakelist.
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2024-10-17 18:09:32 +08:00
fangzhenwei
7a97eef679 serial: use dev references count make sure the driver only opened once
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2024-10-17 18:09:32 +08:00
duqunbo
dfbeba3536 filter redundant hci reset commands due to dual Bluetooth protocol stacks
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2024-10-17 18:09:32 +08:00
wangzhi7
8b68f9d816 [bt_uart.c] fix bug:cant receive data
rootcause: in btuart_rxwork, read data in blocking mode and btuart_read do three times, maybe remote send some packets one time,so it wont read the sencond packets.

Signed-off-by: wangzhi7 <wangzhi7@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
772807c50f bluetooth: add bt_driver_register interface
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>
2024-10-17 18:09:32 +08:00
chengkai
3144971704 bluetooth: extract btuart_register interface
add btuart_create interface, which would be more
flexible in complex cases. And extract btuart_register interface.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
cae60fb4a0 bluetooth: increase HCI RX buffer size.
BLUETOOTH_MAX_FRAMELEN  buffer size is only for LE only mode.
then we need to increase HCI buffer size in BR/EDR and LE mode.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
aeb3051aba bluetooth: fix bt_slip_send would always block
rootcause: semcount maybe zero when nxsem_wait_uninterruptible

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
00eb8f6461 bluetooth: remove noblock mode handle
rootcause: move block and noblock handle to BTH4 handle.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
3fb63c20d4 bluetooth: fix packet pointer may refer to null
rootcasue: when packet is null, packet var in for loop would
refer to null memory.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
cuiziwei
a55d62f477 gnu++20:fix build warning to [-Wmaybe-uninitialized].
17:10:41  wireless/bluetooth/bt_slip.c:300:7: error: 'byte' may be used uninitialized [-Werror=maybe-uninitialized]
17:10:41    300 |       wlerr("err: invalid escape byte %x\n", *byte);
17:10:41        |       ^
17:10:41  wireless/bluetooth/bt_slip.c: In function 'bt_slip_receive':
17:10:41  wireless/bluetooth/bt_slip.c:766:11: note: 'byte' was declared here
17:10:41    766 |   uint8_t byte;
17:10:41        |           ^~~~

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
65fdc5548e bluetooth: add slip SLIP_ESC case break
H5 SLIP_ESC magic payload whould be encode with
SLIP_ESC and SLIP_ESC_ESC

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
af843eb798 bluetooth: check work_available with retxworker
retxworker would delay when there are many tx hci data

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
946dad5ff0 bluetooth: add nxmutex_lock check
Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
fee8b443dd bluetooth:add btslip checksum log for debug
add send btslip checksum log for debug

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
cc36c44824 bluetooth:add btslip driver
add btslip driver.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
67d51bdf4c bluetooth:add bth5 with btslip and bth4
add bth5 with btslip and bth4, which will be more flexible in
btbridge or rpmsghci cases.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
8e17e1657b bluetooth: fix bt bridge would not filter vendor hci cmd
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>
2024-10-17 18:09:32 +08:00
chengkai
f0b7f48adf bluetooth:fix h5 ack to controller timeout
h5 ack which send to controller always timeout, which causing
controller would send repend hci data until host send back h5 ack.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
c55fcb59b8 bluetooth:fix bt bridge acl data connect handle not match
bt bridge filter would not match when ACL in data
head with Packet_Boundary_Flag 0b10. in that case connect handle
is the first 3 octets of the packet, which not match
BT_HCI_EVT_LE_CONN_COMPLETE hci event alloc handle.

Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
a9db2f12de wireless/bluetooth: fix ioctl no match driver param
Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
chengkai
ab991be178 serial/uart/h5: fix hci cmd error when splitting type and value
Signed-off-by: chengkai <chengkai@xiaomi.com>
2024-10-17 18:09:32 +08:00
yangsong8
8c13b8df1d syslog: convert \n to \r\n in syslog framework layer
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-17 02:29:51 +08:00
gaohedong
cfc90ad1f3 nuttx/can: support to Send message priority sorting function.
Linked list-based priority sorting function for sending messages.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2024-10-16 18:37:01 +08:00
yezhonghui
72e7935431 Fix disable msi when msi capability not exist issue
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-10-16 17:12:34 +08:00
zhaohaiyang1
9985b0551e nuttx/can.h: support timestamp for can frame
and update "can.rst" file for add struct timeval ch_ts info.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-16 17:04:31 +08:00
wanggang26
23c39f9dab mmcsd: add multi partitions support
include boot0,boot1,gp1,gp2,gp3,gp4,rpmb

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-16 16:58:37 +08:00
renzhiyuan1
91ce3de250 AI engine driver
Add AI engine driver for heterogeneous NPU backends.

Signed-off-by: renzhiyuan1 <renzhiyuan1@xiaomi.com>
2024-10-16 13:57:23 +08:00
Peter Bee
c3506448c2 drivers/serial: fix cmsdk serial driver warning
serial/serial_cmsdk.c: In function 'uart_cmsdk_ioctl':
serial/serial_cmsdk.c:544:10: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
  544 |   return ret;
      |          ^~~

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2024-10-16 08:05:01 +08:00
zhanghu5
32717ae353 sdio_probe: set voltage use CMD5
reference doc: https://www.infineon.com/dgdl/Infineon-SDIO_platform_support_guide-UserManual-v01_00-EN.pdf?fileId=8ac78c8c8c3de074018c8ba3a9973619

Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2024-10-15 21:04:28 +08:00
yangsong8
0beceeb745 usb: Fix issue with the calculation descriptor length error
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-15 21:00:29 +08:00
dongjiuzhu1
74c9b6f544 drivers/rpmsgdev: support get more battery info by rpmsgdev
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-14 18:08:14 -03:00
wanggang26
9ee4566b4d mmcsd:add reset card to idle state (CMD0) support
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-15 03:15:24 +08:00
chenrun1
b613863bad fs:replase all asprintf / strdup in fs with fs_heap_xxx
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-10-15 01:16:48 +08:00
wanggang26
243148241a mmcsd:add STATUS_SEND (CMD13) support
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-15 01:09:16 +08:00
xuxingliang
cef56fbdb6 drivers/segger: inline note_sysview_get_timestamp
Avoid another layer of function call to get time.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-14 17:03:57 +02:00
xuxingliang
d655569a7c cmake: add newly added sources to cmake
These newly added files are missing from cmake.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-14 17:19:45 +08:00
wangjianyu3
223088d847 misc/rpmsgdev: The private data should be freed only when endpoint is released
A use-after-free problem occurs when there are multiple remotes in the list `g_rpmsg` and the matching remote is not the last item in the list.

Log
  # Export the device "/dev/LOCAL_DEV" to remote "REMOTE_CPU"
  ap> testdev -d 2 -c "REMOTE_CPU" -l "/dev/LOCAL_DEV"
  [ap] kasan_report: kasan detected a read access error, address at 0x3c3d4740,size is 4, return address: 0x2c33620f
  [ap] kasan_show_memory: Shadow bytes around the buggy address:
  [ap] kasan_show_memory:   0x3c3d46f0: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4700: aa aa aa aa cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4710: 40 47 3d 3c ed 61 33 2c 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x3c3d4720: 00 00 00 00 00 00 00 00 00 00 00 00 cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4730: 55 55 55 55 38 00 00 00 02 2c 00 00 cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4740:[00 00 00 00]66 e0 42 3c cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4750: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4760: aa aa aa aa 38 00 00 00 01 2c 00 00 cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4770: 50 57 44 3d 2f 00 cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4780: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] dump_assert_info: Current Version: NuttX ****** ***** *** 12.3.0 **********-***** *** ** 2024 **:**:** arm
  [ap] dump_assert_info: Assertion failed panic: at file: kasan/hook.c:187 task: testdev process: testdev 0x2ca20495

  $ addr2line -fe nuttx/nuttx 0x2c33620f
  rpmsgdev_server_created
  /workspace/nuttx/drivers/misc/rpmsgdev_server.c:529
  # Line 529 => strcmp()

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-10-13 14:42:30 +08:00
zhangwenjian
8b0e5ee8bd drivers/note:add the poll function for noteram
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-13 14:05:50 +08:00
zhangwenjian
7a3c50b3db noteram:support binary read mode
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-13 14:05:50 +08:00
likun17
1fde78ddc6 noteram_driver.c:noteram_dump_printf function replaced with lib_bsprintf.
open CONFIG_DRIVERS_NOTE_STRIP_FORMAT:
OUT:

NuttShell (NSH) NuttX-12.3.0
nsh> hello
nsh> trace dump
loop_task-1   [0]   0.001728177: sched_wakeup_new: comm=loop_task pid=1 target_cpu=0
Idle_Task-0   [0]   0.001745633: sched_wakeup_new: comm=Idle_Task pid=0 target_cpu=0
  hpwork-2   [0]   0.001791495: sched_wakeup_new: comm=hpwork pid=2 target_cpu=0
nsh_main-3   [0]   0.001814164: sched_wakeup_new: comm=nsh_main pid=3 target_cpu=0
   hello-4   [0]   2.583795447: sched_wakeup_new: comm=hello pid=4 target_cpu=0
   hello-4   [0]   2.583843399: tracing_mark_write:
 ###### start long args test!!!
   hello-4   [0]   2.583844088: tracing_mark_write: 0x48ebe0 97 19299 22155 4294967217 4294957304 4294945141 92.999900 9299.929993 92999299929992 18446743074409621624 61 254 429495799   hello-4   [0]   2.583845991: tracing_mark_write: 0x48ec20 qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvb>�/�L�p�J   hello-4   [0]   2.583847105: tracing_mark_write:
 ###### start long args test!!!
   trace-5   [0]   2.928625413: sched_wakeup_new: comm=trace pid=5 target_cpu=0
nsh>

close CONFIG_DRIVERS_NOTE_STRIP_FORMAT:

NuttShell (NSH) NuttX-12.3.0
nsh> hello
nsh> trace dump
loop_task-1   [0]   0.001607506: sched_wakeup_new: comm=loop_task pid=1 target_cpu=0
Idle_Task-0   [0]   0.001624549: sched_wakeup_new: comm=Idle_Task pid=0 target_cpu=0
  hpwork-2   [0]   0.001666256: sched_wakeup_new: comm=hpwork pid=2 target_cpu=0
nsh_main-3   [0]   0.001688556: sched_wakeup_new: comm=nsh_main pid=3 target_cpu=0
   hello-4   [0]   3.812630763: sched_wakeup_new: comm=hello pid=4 target_cpu=0
   hello-4   [0]   0.370899272: tracing_mark_write:
 ###### start NOTE_STRIP_FORMAT test!!!
   hello-4   [0]   0.370900260: tracing_mark_write:            uint8_t[97]:[97]
   hello-4   [0]   0.370900735: tracing_mark_write:           uint16_t[19299]:[19299]
   hello-4   [0]   0.370901155: tracing_mark_write:           uint32_t[22155]:[22155]
   hello-4   [0]   0.370901715: tracing_mark_write:              float[92.9999]:[92.999900]
   hello-4   [0]   0.370902196: tracing_mark_write:             double[9299.929992999299]:[9299.929993]
   hello-4   [0]   0.370902978: tracing_mark_write:             char[][qweretyuiopasdfghjklzxcvbnm]:[qweretyuiopasdfghjklzxcvbnm]
   hello-4   [0]   0.370904061: tracing_mark_write:           uint64_t[92999299929992]:[92999299929992]
   hello-4   [0]   0.370904554: tracing_mark_write:      unsigned char[254]:[254]
   hello-4   [0]   0.370904999: tracing_mark_write: unsigned short int[9299]:[9299]
   hello-4   [0]   0.370905435: tracing_mark_write:       unsigned int[9299992]:[9299992]
   hello-4   [0]   0.370905876: tracing_mark_write:      unsigned long[929992992]:[929992992]
   hello-4   [0]   0.370906402: tracing_mark_write: unsigned long long[9299929924]:[9299929924]
   hello-4   [0]   0.370906822: tracing_mark_write:
 ###### end test!!!
   hello-4   [0]   0.370908999: tracing_mark_write:
 ###### start long args test!!!
   hello-4   [0]   0.370909770: tracing_mark_write: 97 19299 22155 97 19299 22155 92.999900 9299.929993 92999299929992 92999299929992 254 254 9299 9299
   hello-4   [0]   0.370927340: tracing_mark_write: qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweret>��+�c�   hello-4   [0]   0.370928037: tracing_mark_write:
 ###### start long args test!!!
   trace-5   [0]   4.173395106: sched_wakeup_new: comm=trace pid=5 target_cpu=0
nsh>

test SRC:

\#include <nuttx/config.h>
\#include <nuttx/streams.h>
\#include <stdio.h>
\#include <syslog.h>
\#define TOSTR(str)   #str
\#define TONNAME(name) TOSTR(name)

\#define v_uint8_t    97
\#define v_uint16_t   19299
\#define v_uint32_t   22155
\#define v_int8_t     -79
\#define v_int16_t    -9992
\#define v_int32_t    -22155
\#define v_float      92.9999
\#define v_double     9299.929992999299
\#define v_char_arr   qweretyuiopasdfghjklzxcvbnm
\#define v_uint64_t   92999299929992
\#define v_int64_t    -999299929992
\#define v_char       61
\#define v_u_char     254
\#define v_s_int      -9299
\#define v_u_s_int    9299
\#define v_int        -9299991
\#define v_u_int      9299992
\#define v_long       -929992991
\#define v_u_long     929992992
\#define v_l_l        -929992993
\#define v_u_l_l      9299929924
\#define v_size_t     29299
\#define v_l_double   -9299.9299929912122464755474

int main(int argc, FAR char *argv[])
{
\#ifdef CONFIG_DRIVERS_NOTE_STRIP_FORMAT
  sched_note_printf(0, "\n ###### start long args test!!! \n");
  sched_note_printf(0, "%u %u %u %d %d %d %f %f %lu %ld %d %u %d %u",
                    v_uint8_t, v_uint16_t, v_uint32_t, v_int8_t, v_int16_t,
                    v_int32_t, v_float, v_double, v_uint64_t, v_int64_t,
                    v_char, v_u_char, v_s_int, v_u_s_int);

  sched_note_printf(0, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s",
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr));
  sched_note_printf(0, "\n ###### start long args test!!! \n");

\#else

  sched_note_printf(0, "\n ###### start NOTE_STRIP_FORMAT test!!! \n");
  sched_note_printf(0, "           uint8_t["TONNAME(v_uint8_t)"]:[%u]", v_uint8_t);
  sched_note_printf(0, "          uint16_t["TONNAME(v_uint16_t)"]:[%u]", v_uint16_t);
  sched_note_printf(0, "          uint32_t["TONNAME(v_uint32_t)"]:[%u]", v_uint32_t);
  sched_note_printf(0, "             float["TONNAME(v_float)"]:[%f]", v_float);
  sched_note_printf(0, "            double["TONNAME(v_double)"]:[%f]", v_double);
  sched_note_printf(0, "            char[]["TONNAME(v_char_arr)"]:[%.32s]", TONNAME(v_char_arr));
  sched_note_printf(0, "          uint64_t["TONNAME(v_uint64_t)"]:[%lu]", v_uint64_t);
  sched_note_printf(0, "     unsigned char["TONNAME(v_u_char)"]:[%u]", v_u_char);
  sched_note_printf(0, "unsigned short int["TONNAME(v_u_s_int)"]:[%u]", v_u_s_int);
  sched_note_printf(0, "      unsigned int["TONNAME(v_u_int)"]:[%u]", v_u_int);
  sched_note_printf(0, "     unsigned long["TONNAME(v_u_long)"]:[%lu]", (unsigned long)v_u_long);
  sched_note_printf(0, "unsigned long long["TONNAME(v_u_l_l)"]:[%llu]", (unsigned long long)v_u_l_l);
  sched_note_printf(0, "\n ###### end test!!! \n");

  sched_note_printf(0, "\n ###### start long args test!!! \n");
  sched_note_printf(0, "%u %u %u %d %d %d %f %f %lu %ld %d %u %d %u",
                    v_uint8_t, v_uint16_t, v_uint32_t, v_uint8_t, v_uint16_t,
                    v_uint32_t, v_float, v_double, v_uint64_t, v_uint64_t,
                    v_u_char, v_u_char, v_u_s_int, v_u_s_int);

  sched_note_printf(0, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s",
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr));
  sched_note_printf(0, "\n ###### start long args test!!! \n");
\#endif // !CONFIG_DRIVERS_NOTE_STRIP_FORMAT
  return 0;
}

drivers/note/noteram_driver.c

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-13 14:05:50 +08:00
wangmingrong
1b3f3d19e9 noteram: fix variable type
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-10-13 14:05:50 +08:00
yinshengkai
cf0e644a88 note: supports specifying the section where the noteram buffer is located
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-13 14:05:50 +08:00
cuiziwei
4b318cb2cb fix build warning to [-Wstringop-overread].
note/note_driver.c:639:21: warning: 'strlen' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
  639 |           namelen = strlen(tcb->name);
      |                     ^~~~~~~~~~~~~~~~~

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-13 14:05:50 +08:00
cuiziwei
04f3ff5942 nuttx/note:fix runtime error.
note/note_driver.c:1405:11: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x33bf5cc in sched_note_event_ip note/note_driver.c:1405
    #1 0x33bfb57 in note_driver_instrument_enter note/note_initialize.c:55
    #2 0x347b084 in __cyg_profile_func_enter misc/lib_instrument.c:68
    #3 0x34179de in binder_initialize binder/binder.c:669
    #4 0x339a936 in drivers_initialize /home/cuiziwei/vela/happy/nuttx/drivers/drivers_initialize.c:242
    #5 0x335a179 in nx_start init/nx_start.c:632
    #6 0x32f755c in main sim/sim_head.c:180
    #7 0xf6821518  (/lib/i386-linux-gnu/libc.so.6+0x21518) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
    #8 0xf68215f2 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x215f2) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
    #9 0x32b401a in _start (/home/cuiziwei/vela/happy/nuttx/nuttx+0x32b401a) (BuildId: 33f8f7b361d44a008de87fea1bc970b22b48b700)

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-13 14:05:50 +08:00
zhangwenjian
d469216653 note:fix syscall note compile error
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-13 14:05:50 +08:00
zhangwenjian
149b1f186e drivers/note:add the api of sched_note_add
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-13 14:05:50 +08:00
zhangwenjian
7aa1871664 note:support filter for each note channel
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-13 14:05:50 +08:00
yinshengkai
c018be66bd note: merge nc_systime_nsec and sec
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-13 14:05:50 +08:00
zhaoxingyu1
0be1196046 note_driver: time_t outputs in 64-bit format
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2024-10-13 14:05:50 +08:00
cuiziwei
19851c0979 note: Move the instrument register to note_initialize
avoid the instrument doesn't get registered in some case

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-13 14:05:50 +08:00
Xiang Xiao
08829bd388 mtd/nvs: Trigger recovery process in nvs_startup
when mtd driver return -EBADMSG

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 03:10:19 +08:00
Xiang Xiao
7b2dbcf50a drivers/optee: Return error if optee_recv return prematurely
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 02:48:29 +08:00
Bowen Wang
143466baed drivers/pci: fix pci framework warning in 32bit chip
In file included from pci/pci.c:30:
pci/pci.c: In function 'pci_setup_device':
pci/pci.c:449:66: warning: right shift count >= width of type [-Wshift-count-overflow]
  449 |           pci_write_config_dword(dev, base_address_1, res->start >> 32);
      |                                                                  ^~
pci/pci.c: In function 'pci_presetup_bridge':
pci/pci.c:541:51: warning: right shift count >= width of type [-Wshift-count-overflow]
  541 |                              ctrl->mem_pref.start >> 32);
      |                                                   ^~
pci/pci.c: In function 'pci_postsetup_bridge':
pci/pci.c:604:57: warning: right shift count >= width of type [-Wshift-count-overflow]
  604 |                              (ctrl->mem_pref.start - 1) >> 32);
      |                                                         ^~
CC:  pthread/pthread_release.c pci/pci_ecam.c:71:12: warning: initialization of 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  uint32_t *)' {aka 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  long unsigned int *)'} from incompatible pointer type 'int (*)(struct pci_bus_s *, uint32_t,  int,  int,  uint32_t *)' {aka 'int (*)(struct pci_bus_s *, long unsigned int,  int,  int,  long unsigned int *)'} [-Wincompatible-pointer-types]
   71 |   .read  = pci_ecam_read_config,
      |            ^~~~~~~~~~~~~~~~~~~~
pci/pci_ecam.c:71:12: note: (near initialization for 'g_pci_ecam_ops.read')
pci/pci_ecam.c:72:12: warning: initialization of 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  uint32_t)' {aka 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  long unsigned int)'} from incompatible pointer type 'int (*)(struct pci_bus_s *, uint32_t,  int,  int,  uint32_t)' {aka 'int (*)(struct pci_bus_s *, long unsigned int,  int,  int,  long unsigned int)'} [-Wincompatible-pointer-types]
   72 |   .write = pci_ecam_write_config,

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-13 02:28:32 +08:00
xuxin19
4667163152 cmake:add driver thermal CMake scripts
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-13 02:25:06 +08:00
Xiang Xiao
a5aea61537 driver: Post sempahore only when it's value is smaller than one
to avoid waking up the waiting thread redundantly.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-13 02:12:01 +08:00
fangpeina
3f1fd42f73 drivers/input: fix complie err about undefined
There will be compilation errors about undefined reference to `enter_critical_section'.
Fixed by include irq.h

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-10-13 02:03:40 +08:00
wangyongrong
ad2e6fb2ba pci_ivshmem.c: ivshmem_support_irq API support
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>
2024-10-12 12:13:23 +08:00
Bowen Wang
99b6c77c79 drivers/rptun: minor fix about rptun
1. follow the nxstyle, change formot of rptun_init();
2. remove used wqueue header file;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-12 12:12:00 +08:00
xuxingliang
62f0126b06 drivers/segger: add note vprint support
Print note log to sysview terminal.

See https://www.segger.com/products/development-tools/systemview/#logging-output

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-12 09:58:00 +08:00
buxiasen
c4f82c1f66 drivers/timer: fix goldfish timer did not included in cmake
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-12 09:31:15 +08:00
buxiasen
9ea38368ad goldfish_timer: fix interrupt not cleared
will cause a loop interrupt handler, in some new version qemu

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-12 09:31:15 +08:00
ligd
3479622fec serial: use nxsig_tgkill instead of nxsig_kill
Caused nxsig_tgkill is for the one thread, nxsig_kill for the group

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-12 09:30:37 +08:00
Bowen Wang
313d6df787 include/nuttx.h: replace all the align macros to nuttx version
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>
2024-10-11 16:55:43 +08:00
Yongrong Wang
976c4173f0 rpmsg_ping.c: fix msg data memset length
The range of memset exceeds the size of the buffer

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-11 14:59:26 +08:00
Yongrong Wang
4b77dd03db rpmsg_ping.c: change msg cmd type for more compatible
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>
2024-10-11 14:59:26 +08:00
Yongrong Wang
1cf97ac4d0 rpmsg_ping.c: improve log level to LOG_EMERG
Usually rpmsg ping logs are needed during testing,
but too many other module logs can easily overwrite it,
so improve the rpmsg ping log level, later we can setlogmask to
a higher log level to mask other modules' logs.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-11 14:59:26 +08:00
Yongrong Wang
b96ad59d69 rpmsg_ping.c: change check data to fluctuation value
We can found the error happend packet more accurately based
on the data value.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-11 14:59:26 +08:00
yinshengkai
c83858bbb6 note: fix note_common unaligned access
Data in ARMV8-M may be aligned with less than 4 bytes, resulting in USAGE FAULT

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai
464d284587 drivers/note: simplify notesnap_dump logic
RTOSXMDPYX-969

Crash at startup, index is 0 will cause loop printing

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai
a70175ea06 note: make sched_note_start depend on INSTRUMENTATION_SWITCH
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>
2024-10-11 11:55:17 +08:00
yinshengkai
453cde945f note: add note stream drivers
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai
43d96a5d9e note: Increase crash dump buffer
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
zhangwenjian
aec44de921 ICANON mode need echo every bytes
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-11 03:11:26 +08:00
zhangwenjian
7532a0e833 serial:need check old config before setting tty
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-11 03:11:26 +08:00
zhangwenjian
df5c876932 libc:getline support backspace
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-11 03:11:26 +08:00
yinshengkai
ec691cc5e4 tools: prasetrace.py supports parsing syslog
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 01:30:11 +08:00
yinshengkai
211a56910a syslog: support syslog redirection to sched_note
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 01:30:11 +08:00
ligd
e608d5522d syslogmask: add default value Kconfig to syslogmask
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-11 01:30:11 +08:00
yinshengkai
02eb280302 arch/perf: modify the return value of up_perf_gettime to clock_t
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>
2024-10-10 23:17:14 +08:00
yintao
37a30023f5 nuttx/drivers: add ept_release_cb for destroy server resource
use ept_release_cb to destory rpmsg services server dile resource
to avoid the used-after-free issue

Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-10 08:44:29 +08:00
hujun5
e249dd2672 arch: support customized up_cpu_index() in AMP mode
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>
2024-10-10 02:38:40 +08:00
Bowen Wang
092bdec20b drivers/serial: support force panic only when repeat the panic char
We can increase the panic repeat count to avoid abnormal crashes
caused by serial port interference.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-10 02:38:12 +08:00
Bowen Wang
bbb7f436d4 serial.c: should protect the fds when calling poll_notify
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>
2024-10-10 02:38:12 +08:00
ligd
0a70235b0c serial/pl011: fix can't up_putc() after setup
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-10 02:38:12 +08:00
ligd
94cc99d01b serial: fix cu ctrl+c crash
__assert
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/libs/libc/assert/lib_assert.c:36
nxsem_recover
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/semaphore/sem_recover.c:86 (discriminator 3)
nxtask_recover
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_recover.c:79
nxtask_exithook
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_exithook.c:448
nxtask_terminate
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_terminate.c:110
pthread_cancel
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/pthread/pthread_cancel.c:110
cu_main
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/apps/system/cu/cu_main.c:485
nxtask_startup
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/libs/libc/sched/task_startup.c:70 (discriminator 2)
nxtask_start
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_start.c:134

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-10 02:38:12 +08:00
sunjikun
ee306d47fd drivers/serial: Add 16550_DLF_SIZE option for DesignWare UART.
Signed-off-by: sunjikun <sunjikun@xiaomi.com>
2024-10-10 02:38:12 +08:00
Bowen Wang
89c49c53a7 virtio-mmio/pci: add alloc_buf/free_buf for mmio and pci transport layer
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>
2024-10-09 23:32:58 +08:00
wangyongrong
0b1f45d600 rptun: rptun implements notify_wait through rvdev->notify_wait_cb
notify_wait has been remove in remoteproc ops and virtio_dispatch and
has been moved to the struct rpmsg_virtio_device in new OpenAMP,
so change the rptun too,

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-09 23:32:58 +08:00
Yongrong Wang
1b24139020 virtio-pci/mmio: Features change to 64 bit in all virtio_dispatch and fix compile warning
virtio/virtio-pci-legacy.c:399:48: warning: passing argument 2 of ‘pci_bus_write_io_dword’ makes integer from pointer without a cast [-Wint-con>
  399 |   pci_write_io_dword(vpdev->dev, vpdev->ioaddr + VIRTIO_PCI_GUEST_FEATURES,
      |                                                ^
      |                                                |
      |                                                void *
/home/wyr/work/code/project/vela/nuttx/include/nuttx/pci/pci.h:559:65: note: expected ‘uintptr_t’ {aka ‘long unsigned int’} but argument is of >
  559 | int pci_bus_write_io_dword(FAR struct pci_bus_s *bus, uintptr_t where,
      |                                                       ~~~~~~~~~~^~~~~

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-09 23:32:58 +08:00
wangyongrong
5aeb644bc5 virtio: adapt to the new OpenAMP
Sync all the virtio api usage to sync with new OpenAMP

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-09 23:32:58 +08:00
wangyongrong
8e799ff823 rpmsg: upgrade API passing on parameters with the upgrade of OpenAMP
All the rpmsg transport layer and rpmsg services sync the API
with new OpenAMP

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-09 23:32:58 +08:00
buxiasen
264252497c pm: fix pm_wakelock_uninit api block, wd api need irq not disabled
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-09 23:31:49 +08:00
dongjiuzhu1
a005f4bff1 drivers/power: using baterr/batinfo to avoid frequency log output
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-09 23:31:49 +08:00
zhangshengchao
e26a01d9a6 regulator:add bypass logic when registering
do not control regulators when set bypass flag

Signed-off-by: zhangshengchao <zhangshengchao@xiaomi.com>
2024-10-09 23:31:49 +08:00
wanggang26
955a3838f7 mmcsd: refine emmc capacity calculate
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-09 22:24:18 +08:00
yinshengkai
3271142b87 note: print without relying on format strings
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 22:23:29 +08:00
yinshengkai
b5cf4310cb gote: implement asynchronous printf formatting
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>
2024-10-09 22:23:29 +08:00
liwenxiang1
fa48d9e972 drivers/timers:Arch_alarm and arch_timer add up_ndelay interface
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-09 22:11:03 +08:00
Bowen Wang
6ea3dcace4 misc/rpmsgdev: fix block mode read/write bug in rpmsgdev
Rpmsg dev server always open the real char device with nonblock mode,
so let client try to read/wrtie the read device every read/write
operation.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 19:53:28 +08:00
liwenxiang1
0647b49990 drivers/battery: Fix Goldfish Battery x64 unresponsive interrupt issue
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-09 18:32:29 +08:00
anjiahao
fa59adde40 Simplify BOARD_MEMORY_RANGE initialization logic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
yangsong8
81d704cd82 gdbstub: support the use of recvbuf and sendbuf
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-09 15:41:48 +08:00
anjiahao
e007ace00d gdbstub:support only use gdbstub when panic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
lipengfei28
15126945cd qemu_epc_get_msi: flag should use msi enable flag
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 15:07:37 +08:00
yangsong8
954e84c82a usb: If usb3.0, set the ep0 sssize to cfgdescsize
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-09 14:19:16 +08:00
wanggang26
ecc2d473e3 mmcsd: add multi partitions prototype implementation
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-09 13:57:07 +08:00
lipengfei28
42041a428c include/nuttx.h: add common align definitions for nuttx
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
lipengfei28
4ebf830bbd userspace: Exclude nuttx/arch.h
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
Bowen Wang
acbe19d744 pci_drivers: move qemu edu and test device header content to pci_drivers.h
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 13:52:01 +08:00
lipengfei28
1ce6ec7c65 declare pci_dev_register
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
lipengfei28
bc6cd326b8 pci test drv is pci rc drv not pci ep drv
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
Bowen Wang
23b40818cb misc/dev_mem: fix compile error in aarch64
misc/dev_mem.c:203:24: error: comparison between two arrays [-Werror=array-compare]
  203 |   bool merge = (_edata == _sbss);
      |                        ^~
misc/dev_mem.c:203:24: note: use '&_edata[0] == &_sbss[0]' to compare the addresses

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 12:11:20 +08:00
Xiang Xiao
b068e2357a circbuf: Move from mm/circbuf to libs/libc/misc
so that it can be used by userspace program.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
xuxingliang
5dffc61097 sched/note: add wdog note for segger sysview
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-09 08:39:58 +08:00
xuxingliang
bc5a337a58 sched/note: add note for wdog module
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-09 08:39:58 +08:00
chenzhijia
5f2bd4c655 drivers/coresight:Add TRFCR_EL1 initialization
Add TRFCR_EL1 initialization in ETM4 driver

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
6f8501e564 nuttx/drivers:Fix coresight compilation error
CC:  coresight/coresight_etm4.c coresight/coresight_etb.c: In function 'etb_open':
coresight/coresight_etb.c:334:19: error: implicit declaration of function 'enter_critical_section' [-Werror=implicit-function-declaration]
  334 |           flags = enter_critical_section();
      |                   ^~~~~~~~~~~~~~~~~~~~~~
coresight/coresight_etb.c:346:11: error: implicit declaration of function 'leave_critical_section' [-Werror=implicit-function-declaration]
  346 |           leave_critical_section(flags);
      |           ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
a443a37390 drivers/coresight:ETM4 setup
Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
48a5419005 drivers/coresight:Add caps member to coresight_desc_s for etr
Add caps member to coresight_desc_s for etr and fix etr compilation error

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
49ad5e05d5 drivers/coresight:Fix coresight_replicator.c compilation error
Fix coresight_replicator.c compilation error, ret is not initialized

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
ligd
6dc08ee681 pci: fix compile failed, fdt_get_reg_base() need 3 args
goldfish: fix compile failed, fdt_get_irq_by_path() need 4 args

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 02:18:49 +08:00
Bowen Wang
ba18f87a9e devicetree/fdt: fix fdt_get_reg_size() get wrong size
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 02:18:49 +08:00