Commit Graph

54122 Commits

Author SHA1 Message Date
buxiasen 317afc5ab7 pm: add pm_idle, up_idle only handle pm state execution
pm process should be done by chip specific, but we can provide a standard
flow, then vendor & chip can only focus on handle different state change.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-21 10:53:33 +08:00
zhanghongyu a5a35a1cda defconfig: add SYSTEM_TELNETD related config
fixed an error that symbols could not be found when link

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 10:51:20 +08:00
Daniel Jasinski 9798bc1d1f build: fix syscall instrumentation in flat build
This fixes syscall instrumentation in flat build:

 - add syscall_names.c if LIB_SYSCALL=n to 'wraps'
   subdirectory

 - change execute_process to add_custom_command

 - fix typo in wrapper naming convention

Signed-off-by: Daniel Jasinski <jasinskidaniel95szcz@gmail.com>
2024-08-21 10:50:30 +08:00
Rodrigo Sim ea5bb64f42 nucleo-l432kc: Revert the USART2 config to be use by virtual COM port
This reverts commit 60236ce94d and fix
the issue reported by https://github.com/apache/nuttx/issues/13061.

Signed-off-by: Rodrigo Sim rcsim10@gmail.com
2024-08-21 10:47:37 +08:00
guohao15 c3791756b2 rpmsgfs: set fs type to rpmsgfs when mount through rpmsgfs
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-21 04:28:19 +08:00
buxiasen a18e4e85e9 pm_activity: fix deadlock with spinlock and critcal_section
critical_section is not compatible with irq disabled, have to delay the
wd_start after spin_unlock_irqrestore.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-20 17:01:48 -03:00
chenrun1 bb4d710d62 xtensa_cache:Disable clean/flush optimization in case of SMP restriction
In a multicore task scenario, there may be a situation where the task runs on different cores at different time slices (when the task is not bound to a particular core).
When the task calls cache clean/flush(range > cache size), depending on the optimization, clean_all, flush_all are called. however, at this point, there may be dirty data or incomplete data profiles in the cache on the kernel that is running the task, which may result in dirty data being flushed into memory or make the application think that the flushed data should be successfully flushed into memory, leading to unknown consequences.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 03:04:41 +08:00
chenrun1 91cf97ed84 arm_cache:Disable clean/flush optimization in case of SMP restriction
In a multicore task scenario, there may be a situation where the task runs on different cores at different time slices (when the task is not bound to a particular core).
When the task calls cache clean/flush(range > cache size), depending on the optimization, clean_all, flush_all are called. however, at this point, there may be dirty data or incomplete data profiles in the cache on the kernel that is running the task, which may result in dirty data being flushed into memory or make the application think that the flushed data should be successfully flushed into memory, leading to unknown consequences.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 03:04:41 +08:00
wangming9 0c12fb9237 arm/armv8-r: Fix cache interface
Signed-off-by: wangming9 <wangming9@xiaomi.com>
2024-08-21 03:04:41 +08:00
wangming9 0bfd4c5e0d arm/armv8-r: Adding a cache interface to armv8-r
Summary:
1. Add up_get_icache_size、up_get_dcache_size
2. Added L2 cahce PL310 implementation

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2024-08-21 03:04:41 +08:00
guoshichao ddc6e31740 libc/fputwc: fix the return value truncated from stdio interface
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao d74e37d9db wchar/wcsstr: fix the variable overflow bug
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao ca1e007a22 wchar/lib_ungetwc: fix the array access out of bounds error
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao 9876b0b615 wchar/fgetwc: fix the return value truncate error
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao 390275f867 wchar/putwc: fix the putwc return value truncate error
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
fangxinyong 13cb355a4e arm/armv[7|8]-m: add syn barrier for MPU ops
Execute data and instruction sync barriers after writing MPU register,
to ensure MPU setting take effects that the new changes are seen.

testing in lm3s6965-ek:qemu-protected

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-08-21 02:57:25 +08:00
jianglianfang 1e29b8de1d driver/fb:remove overlay from fb_notify_vsync
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-21 02:57:08 +08:00
jianglianfang 468617096e goldfish_fb: add notify vsync
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-21 02:57:08 +08:00
jianglianfang 8122cbd5d2 drivers/video: add fb_vsync_pollnotify
when the vsync comes, fb drivers should call fb_vsync_pollnotify to notify POLLPRI, so that users can catch the synchronization time of vsync and do something.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-21 02:57:08 +08:00
wanggang26 a2662bd369 mmcsd: add support of getting ext_csd reg data
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-08-21 02:53:54 +08:00
guoshichao 24ce8dfbf2 armv7-a/irq: add up_irq_disable method implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
(cherry picked from commit 7059b05e501d67c342f1753e8eb96e723b99d6b8)
2024-08-21 02:53:04 +08:00
guoshichao 0aa7e39eef nuttx/arch/irq: add up_irq_disable method implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:53:04 +08:00
chenrun1 96abb51562 lib_getcwd:Fix the Name in the function description.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 02:52:45 +08:00
zhanghongyu ccf60a7bab netdev_upperhalf: add polling mode support for tx/rx
support more work modes to support more scenarios

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:31:53 +08:00
liqinhui bf78bf1db4 net/tcp: reset the dupack counter.
After setting the retransmission flag, we need to set the dupack counter to 0.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2024-08-21 02:12:55 +08:00
SPRESENSE eea5f98bca drivers/modem/alt1250: Disable the PIN feature in ALT1250
Disable the PIN feature in ALT1250 because the SIM may
accidentally become unusable.
2024-08-21 02:11:02 +08:00
liqinhui 4c69ef988f simwifi: Add the netlink event of connect/disconnect.
Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2024-08-21 02:08:10 +08:00
chenrun1 5bf24a15b5 lib_getnprocs:add #include <sys/types.h> instead of ifdef
Summary:
  Since there is a default definition for CONFIG_SMP_NCPUS in sys/types.h, we can remove #ifdef and return CONFIG_SMP_NCPUS directly.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 02:04:15 +08:00
chenrun1 f3cf11dcb5 libc/msic:Implement get_nprocs API
Summary:
 1.Remove the macro definition of getnproc in sysinfo
 2.New get_nprocs_conf and get_nprocs interfaces, return CONFIG_SMP_NCPUS, return 1 when not defined

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 02:04:15 +08:00
zhanghongyu aa2ae421d5 Documentation: add documentation for USB cdcncm device
add a documented description of the cdcncm device module, including
execution steps and associated outputs

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
zhanghongyu 640b766d2b usbdev/cdcncm: fix some issues
1. increase CDCECM_MXDESCLEN to avoid memory overrun when sending
configuration description(mkcfmdesc) information

2. correct the request structure used in the notify phase

3. disable unused configuration options

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
zhanghongyu 7aa3e2ebd6 cdcncm: switch net driver to netdev_lowerhalf
optimize the interaction flow associated with network drivers to reduce
the amount of code and improve compatibility

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
zhanghongyu 4e79741e7d usbdev: add ncm driver
The compilation and verification commands are shown below:
./tools/configure.sh sim:usbdev
make -j
sudo ./nuttx
nsh> conn 2
nsh> dhcpd_start eth1

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
xuxin19 b328b35e2b cmake:bugfix fix CMake post_build phase time orderless
[1209/1210] cd cmake_out && arm-none-eabi-objcopy -O binary nuttx nuttx.bin && arm-none-eabi-objcopy -O binary nuttx vela_core1.bin && cp nuttx vela_core1.elf && cp nuttx.hex vela_core1.hex && cp nuttx.map vela_core1.mapfile
FAILED: boards/exclude_board/CMakeFiles/nuttx_post_build /home/work/ssd1/workspace/MiRTOS-car-dev-CI/cmake_out/boards/exclude_board/CMakeFiles/nuttx_post_build
cd cmake_out && arm-none-eabi-objcopy -O binary nuttx nuttx.bin && arm-none-eabi-objcopy -O binary nuttx vela_core1.bin && cp nuttx vela_core1.elf && cp nuttx.hex vela_core1.hex && cp nuttx.map vela_core1.mapfile
cp: cannot stat 'nuttx.hex': No such file or directory
[1210/1210] Generating nuttx.hex
ninja: build stopped: subcommand failed.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-21 01:53:09 +08:00
xuxin19 b1b66ce491 cmake:add unified timing control phase apps_context for apps build
solve the interdependency problem of cross-target dependency generation.
like Makefile base, a PHONY context target is used as a dependency for timing order.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-21 01:53:09 +08:00
hujun5 4cb419866f arch: inline up_testset in arm arm64 riscv xtensa
test:
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-08-21 01:45:10 +08:00
cuiziwei 7b43a9413a arch/EXTRA_LIBS: link all staging library.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-08-21 01:40:15 +08:00
Zhe Weng 648c52fc4b drivers/virtio-net: Use `reclaim` in `ops` to finish TODO
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-21 01:39:34 +08:00
zhanghongyu d740a8e73c netdev_lowerhalf: add reclaim callback in netdev_ops_s
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 01:39:34 +08:00
wangchen ff7eda46e7 net_chksum.c:mod process of generating sum to solve checksum error
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-21 01:38:23 +08:00
wangchen 27c2940df2 netdev/ioctl: Setting log level to warning on SIOCGIFHWADDR failure
When our apps call getifaddrs on lo frequently, the loopback device will failed in SIOCGIFHWADDR and print too many error logs.

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-21 01:37:06 +08:00
guoshichao 07c370817c armv7a/irq: enable fiq in tee, enable irq in ap
According to the current design on the armv7-a platform,
only fiq is processed in TEE, while irq and fiq are processed
in REE.
If we enable the irq function in TEE, when we process
some signal-related scenarios in TEE,
such as the ostest sighand testcase, this testcase will
call up_irq_enable() to enable irq interrupt in the
arm_sigdeliver() function. After the signal processing
logic is executed, irq will be disabled again.
During the interval of enabling irq, some external device
irq interrupts will be enabled, but these external device
irqs do not have corresponding handlers registered in TEE,
so an "unexpected irq isr exception" will be triggered.
Therefore, a better implementation is to keep the original
implementation of the up_irq_enable() function, that is,
to enable only fiq in TEE and to enable irq and fiq in REE.
Then  for vendor-specific requirements, such as the need to
briefly enable irq during the TEE initialization process
and then disable irq before starting APz in TEE, we directly
provide a separate implementation of enabling irq in the
vendor, without modifying the implementation of the public
up_enable_irq() function.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 01:36:32 +08:00
liqinhui 590c7fe129 icmpv6: Allow IPv6 address obtained by both
stateless and stateful to coexist.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2024-08-21 01:33:28 +08:00
liqinhui c00ff58baa icmpv6: Set the default gateway for the stateful dhcpv6.
Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2024-08-21 01:33:28 +08:00
buxiasen 0329407d27 procfs/mempool: fix did not remove when pool not enabled
will at lease lead to extra code size cost, also possible dataabort.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-21 01:25:34 +08:00
wangchen 34fa02a652 icmp:add net_lock to protect icmp connection
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-20 11:21:08 -03:00
wangchen 146767a8a2 netdb:netdb code support ffmpeg rtsp(getaddrinfo & getnameinfo)
Related Codes:
1.ffmpeg/libavformat/ip.c
struct addrinfo *ff_ip_resolve_host(void *log_ctx,
                                    const char *hostname, int port,
                                    int type, int family, int flags)
{
    struct addrinfo hints = { 0 }, *res = 0;
    int error;
    char sport[16];
    const char *node = 0, *service = "0";

    if (port > 0) {
        snprintf(sport, sizeof(sport), "%d", port);
        service = sport;
    }
    if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
        node = hostname;
    }
    hints.ai_socktype = type;
    hints.ai_family   = family;
    hints.ai_flags    = flags;
    if ((error = getaddrinfo(node, service, &hints, &res))) {
        res = NULL;
        av_log(log_ctx, AV_LOG_ERROR, "getaddrinfo(%s, %s): %s\n",
               node ? node : "unknown",
               service,
               gai_strerror(error));
    }

    return res;
}
2.ffmpeg/libavformat/rtsp.c
static int sdp_read_header(AVFormatContext *s)
{
    RTSPState *rt = s->priv_data;
    RTSPStream *rtsp_st;
    int i, err;
    char url[MAX_URL_SIZE];
    AVBPrint bp;

    if (!ff_network_init())
        return AVERROR(EIO);

    if (s->max_delay < 0) /* Not set by the caller */
        s->max_delay = DEFAULT_REORDERING_DELAY;
    if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
        rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;

    /* read the whole sdp file */
    av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
    err = avio_read_to_bprint(s->pb, &bp, INT_MAX);
    if (err < 0 ) {
        ff_network_close();
        av_bprint_finalize(&bp, NULL);
        return err;
    }
    err = ff_sdp_parse(s, bp.str);
    av_bprint_finalize(&bp, NULL);
    if (err) goto fail;

    /* open each RTP stream */
    for (i = 0; i < rt->nb_rtsp_streams; i++) {
        char namebuf[50];
        rtsp_st = rt->rtsp_streams[i];

        if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
            AVDictionary *opts = map_to_opts(rt);
            char buf[MAX_URL_SIZE];
            const char *p;

            err = getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip,
                              sizeof(rtsp_st->sdp_ip),
                              namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
            if (err) {
                av_log(s, AV_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(err));
                err = AVERROR(EIO);
                av_dict_free(&opts);
                goto fail;
            }
            ff_url_join(url, sizeof(url), "rtp", NULL,
                        namebuf, rtsp_st->sdp_port,
                        "?localport=%d&ttl=%d&connect=%d&write_to_source=%d",
                        rtsp_st->sdp_port, rtsp_st->sdp_ttl,
                        rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0,
                        rt->rtsp_flags & RTSP_FLAG_RTCP_TO_SOURCE ? 1 : 0);

            p = strchr(s->url, '?');
            if (p && av_find_info_tag(buf, sizeof(buf), "localaddr", p))
                av_strlcatf(url, sizeof(url), "&localaddr=%s", buf);
            else if (rt->localaddr && rt->localaddr[0])
                av_strlcatf(url, sizeof(url), "&localaddr=%s", rt->localaddr);
            append_source_addrs(url, sizeof(url), "sources",
                                rtsp_st->nb_include_source_addrs,
                                rtsp_st->include_source_addrs);
            append_source_addrs(url, sizeof(url), "block",
                                rtsp_st->nb_exclude_source_addrs,
                                rtsp_st->exclude_source_addrs);
            err = ffurl_open_whitelist(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ,
                           &s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);

            av_dict_free(&opts);

            if (err < 0) {
                err = AVERROR_INVALIDDATA;
                goto fail;
            }
        }
        if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
            goto fail;
    }
    return 0;
fail:
    ff_rtsp_close_streams(s);
    ff_network_close();
    return err;
}

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-20 10:33:18 -03:00
wangchen a18aebc2c6 wifi_sim.c:fix compile warning
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-20 14:46:15 +08:00
zhanghongyu 3c4897310b tcp_input: if tcp->req > recvreq, send ack only when state is TCP_ESTABLISHED
The Bluetooth network on N62 does not retransmit packet, so no packet
retransmition if we drop one, we will drop packet when tcp_close_eventhandler
is register and invoke by tcp_input. then we will always early return and
never stop, the peer will only close the connection if we send reset packet.

precondition:
close -> register tcp_close_eventhandler;

tcp_input -> tcp_callback(TCP_NEWDATA) -> devif_conn_event -> tcp_close_eventhandler
-> flags &= ~TCP_NEWDATA -> NOT entry tcp_data_event -> conn->recvreq NOT increase

old flow:
tcp_input -> tcp->seqno greater than conn->rcvseq -> tcp_send(TCP_ACK)

with this patch:
tcp_input -> tcp->seqno greater than conn->rcvseq -> !TCP_ESTABLISHED
-> case TCP_FIN_WAIT_1 -> dev->d_len greater than 0 -> tcp_reset

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-20 08:31:55 +02:00
wangchen 5fedb1e6de tcp_timer.c:solve Problem of parameter calculation exceeding the boundary
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-20 13:51:39 +08:00