Commit Graph

7063 Commits

Author SHA1 Message Date
pangzhen1
8bb62e532c nuttx/syscall: delete getrandom in syscall.csv
delete getrandom in syscall.csv, because it has been moved to libc.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2024-08-27 21:44:33 +08:00
likun17
7913b249ca drivers/regmap: add exit function interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-08-27 21:43:58 +08:00
makejian
8de247543f crypto: export interfaces abort aes-cmac
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
makejian
28974b8a21 crypto: export crc32 from /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
Zhe Weng
90c0acce05 net/tun: Support changing carrier state of TUN/TAP
Add TUNSETCARRIER ioctl, then we may change the carrier state of TUN dynamically. Note that we don't need an ioctl for getting carrier, it can be done by SIOCGIFFLAGS already.

Ref: https://github.com/torvalds/linux/blob/v6.10/drivers/net/tun.c#L3374-L3380

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-26 17:34:23 -03:00
yanghuatao
91e341dbda toolchain/ghs: ioexpander_dev_s "declaration is not visible outside of function" warning
CC:  serial/serial_io.c "/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/power/regulator.h", line 227: warning #231-D:
          declaration is not visible outside of function
  int regulator_gpio_init(FAR struct ioexpander_dev_s *iodev,

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yanghuatao
edce454d55 toolchain/ghs: Fix trailing comma is nonstandard warnings
"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yanghuatao
ac26e83a45 toolchain/ghs: Fix unknown attribute warnings
"string/lib_strlen.c", line 54: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strncpy.c", line 81: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strncmp.c", line 58: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strchr.c", line 73: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strcpy.c", line 68: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address

"procfs/fs_procfstcbinfo.c", line 185: warning #1097-D: unknown attribute
          "optimize"
  nooptimiziation_function

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
Xiang Xiao
fcb3e84c24 can: Merge netpacket/can.h into nuttx/can.h
To align with the layout of Linux can header file.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-26 05:05:31 -04:00
Petro Karashchenko
282cf2f7d0 sys/socket: implement compiler agnostic sockaddr_storage alignment
'aligned_data' is compiler dependent, but Open Group Base Specifications
describe compiler agnostic solution that can be used:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:25:05 +08:00
Petro Karashchenko
1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
meijian
a4b4fd16e9 netlib/route: add length for add/del route-func to reduce caller stack usage
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-26 01:54:10 +08:00
yinshengkai
84333881d7 mm: add mm_largest api to get the current largest available memory block
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
2cdfda149a mm: memory pressure support returns the maximum available memory
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
49d1b4198f mm: add memory pressure notification support
Add mm_heap_free interface to pass remaining memory to memory pressure

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
f44a31c337 procfs: add memory pressure notification support
This is a memory monitoring interface implemented with reference to Linux's PSI (Pressure Stall Information),
which can send notifications when the system's remaining memory is below the threshold.

The following example code sets two different thresholds.
When the system memory is below 10MB, a notification is triggered.
When the system memory is below 20 MB, a notification (POLLPRI event) is triggered every 1s.

```
int main(int argc, FAR char *argv[])
{
  struct pollfd fds[2];
  int ret;

  if (argc == 2)
    {
      char *ptr = malloc(1024*1024*atoi(argv[1]));
      printf("Allocating %d MB\n", atoi(argv[1]));
      ptr[0] = 0;
      return 0;
    }

  fds[0].fd = open("/proc/pressure/memory", O_RDWR);
  fds[1].fd = open("/proc/pressure/memory", O_RDWR);
  fds[0].events = POLLPRI;
  fds[1].events = POLLPRI;

  dprintf(fds[0].fd, "%llu -1", 1024LLU*1024 * 10);
  dprintf(fds[1].fd, "%llu 1000000", 1024LLU*1024 * 20);

  while (1)
    {
      ret = poll(fds, 2, -1);
      if (ret > 0)
        {
          printf("Memory pressure: POLLPRI, %d\n", ret);
        }
    }

  return 0;
}
```

https://docs.kernel.org/accounting/psi.html
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
Petro Karashchenko
d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
guoshichao
dd7ecd9aef greenhills: fix the ioexpander/gpio.h build warning
CC:  mm_heap/mm_brkaddr.c "/home/guoshichao/work_profile/vela_os/vela_car_4/nuttx/include/nuttx/ioexpander/gpio.h", line 159: warning #381-D:
          extra ";" ignored
    uint8_t gp_pintype;  /* See enum gpio_pintype_e */;
                                                      ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
guoshichao
a06c97d599 greenhills: fix the netdev.h build warning
"/home/guoshichao/work_profile/vela_os/vela_car_4/nuttx/include/nuttx/net/netdev.h", line 493: warning #231-D:
          declaration is not visible outside of function
                                            FAR struct netdev_ifaddr6_s *addr,
                                                       ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
guoshichao
e5835d6ce8 greenhills: fix the macro undefined warning
CC:  mount/fs_foreachmountpoint.c "/home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/include/nuttx/mqueue.h", line 40: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_MQ_MAXMSGSIZE"
  #if CONFIG_MQ_MAXMSGSIZE > 0
      ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
daichuan
fe01d7c462 modify for offload checksum and add macro with tcp/icmp/icmpv6/igmp checksum
Signed-off-by: daichuan <daichuan@xiaomi.com>
2024-08-24 20:41:40 +08:00
meijian
099ced4c83 [wireless] add pmksa get IOCTL id
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-24 18:09:07 +08:00
meijian
7cebfd0059 [wireless][header] Normalize IOCTL id
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-24 18:09:07 +08:00
guohao15
fb72fe6364 include/fcntl.h: add O_LARGEFILE flags
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-24 18:06:14 +08:00
guohao15
99c6f2e568 sys/shm.h: add macro define for posix
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-24 18:04:22 +08:00
yinshengkai
a72c9a41e1 include/debug.h: fix _alert log level error
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-24 11:20:59 +08:00
makejian
10168903cc crypto/bn: add method to calculate inv mod and gcd
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-24 11:20:17 +08:00
makejian
21514e266a crypto/bn: bignum supports negative number operations
1.Add sign to indicate negative and positive
2.Fix case where there are negative numbers in the operation
3.expand to 512 bytes to support rsa2048

Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-24 11:20:17 +08:00
zhangkai25
9e388d1d00 Capture adds the function of edges counting
Description: Add the function of counting cap edges

Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-08-24 11:18:05 +08:00
Zhe Weng
a591adc6d5 drivers/pipes: Add offset support for PIPEIOC_PEEK
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-23 16:14:39 -03:00
makejian
9769816385 crypto: fix wrong implementation in crypto module
(1) RSA_PKCS15_VERIFY Misspell
(2) if iv not provided during decryption, iv should get from data.
It was not discovered before because all symmetric decryption comes with iv.
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-23 12:57:37 -03:00
gaohedong
12a44bd974 can: CAN code optimization
Some macro definitions have already been defined in other header files, redundant macro definitions have been removed in include/nuttx/can.h. Align some code. Remove no use struct (can_response_s) and some variables.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-23 20:18:17 +08:00
chao an
75fac7dbc6 sched/nxevent: add support of kernel event group
Events groups are synchronization primitives that allow tasks to wait
for multiple conditions to be met before proceeding. They are particularly
useful in scenarios where a task needs to wait for several events to occur
simultaneously.

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-23 17:00:35 +08:00
renjianguang
7ff17d0627 nuttx/audio: ap_buffer_s add nsamples Field for non-pcm formats
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2024-08-23 08:57:00 +08:00
renjianguang
87e24d13b4 nuttx/audio: add opus format support
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2024-08-23 08:57:00 +08:00
yinshengkai
667de7be32 mutex: add nxrmutex_is_recursive api
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
a2b8c83e0e mutex: align nxmutex_breaklock interface with nxrmutex_breaklock
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
01864d262c sched: add mutex_holder and mutex_clocklock API
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
guohao15
c63adb5c14 hcreate: add alloc/free func hook for user to deallocate memory
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
jinxiuxu
7355629d19 audio: add 12K sample rate support
Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2024-08-22 09:13:51 -03:00
Zhe Weng
acbddd11d5 net/netdev: Add periodic log for netdev statistics
Work for every network device using `CONFIG_NETDEV_STATISTICS`.

Log style:
<interface>:T{done}/{total},R({v4}+{v6})/{total} {Protocol}:T{tx},R{rx},D{drop}
Example:
wlan0:T10/10,R(10+20)/31 TCP:T0,R0,D0 UDP:T0,R10,D0 ICMP:T0,R0,D0 ICMP6:T0,R0,D0

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-22 16:17:56 +08:00
guohao15
52e5d69236 api:add lib_realpath function
FAR char *lib_realpath(FAR const char *path, FAR char *resolved, bool notfollow);

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 15:24:48 +08:00
makejian
947b24c8c1 crypto/poly1305: export poly1305 mac algorithm via /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-22 13:40:24 +08:00
makejian
8628cc9c0e crypto/ripemd160: export ripemd160 algorithm via /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-22 13:40:24 +08:00
zhanghongyu
418b692e21 usbdev/cdcmbim: add response notify
when the host is needed to read the data, RESPONSE_AVAILABLE must first
be sent.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:56:26 +08:00
zhanghongyu
5b24917bb9 usb_cdcmbim: add mbim device driver
./build.sh sim:usbdev -j12
sudo gdb nuttx/nuttx -ex "source nuttx/tools/gdb/__init__.py"

below command to create mbim NIC on host
nsh> conn 3

NuttX's MBIM device implementation adds an additional MBIM network
card to the NuttX system, which can debug the data communication with
the host, but this network card is unnecessary and needs to be removed
when the business actually uses this driver, And the cdcncm_receive
method needs to be re-implemented.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:56:26 +08:00
guohao15
16afee6f0c notify:add path tmp buffer
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:54:22 +08:00
chenrun1
dba77ff043 fslock:Optimize the performance overhead caused by frequent close
Summary:
  Indicate whether the file is currently locked by adding a new field locked to filep.
    0 - Unlocked
    1 - Locked
  The status of the filep at close is used to determine whether to continue with the following procedure.

  Optimizing performance:
Before
  Time taken to close the file: 33984 nsec
After
  Time taken to close the file: 23744 nsec
Improvement of about 10 msec

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
guohao15
86e00896d3 fs:notify add support for inotify
support API: open close read write unlink mkdir rename fchstat rmdir symlink

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
chenrun1
6e1dfe2777 include/wchar:Fix mbstate_t Redeclaration in MSVC
Summary:
  Because stdio.h references stdatomic.h in MVSC, it internally declares mbstate_t, leading to redeclarations during compilation.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:44:29 +08:00