luckfox-pico-sdk/sysdrv/source/mcu/rt-thread/third_party/wice/wice_init.c
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

152 lines
4.0 KiB
C

/**
* Copyright (c) 2019 Fuzhou Rockchip Electronic Co.,Ltd
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************
* @file wice_init.c
* @author aaron sun
* @version V0.1
* @date 25-JUN-2019
* @brief wice for rtt wlan struct interface
*
******************************************************************************
*/
#include "rtthread.h"
#include "rtdevice.h"
#include "hal_base.h"
#include "wice_rtt_interface.h"
#ifndef RT_USING_WICE_MFG_TEST
static void usage(void)
{
rt_kprintf("wice command\n\n");
rt_kprintf("wice [-c | -d | -a | -s | -e | -q]\n\n");
rt_kprintf(" -c create wice driver\n");
rt_kprintf(" -d delete wice driver\n");
rt_kprintf(" -a auto create and delete wice\n");
rt_kprintf(" -q quit create and delete wice\n");
rt_kprintf(" -s start airkiss\n");
rt_kprintf(" -e end airkiss\n");
rt_kprintf(" -g get airkiss result\n");
rt_kprintf("Examples:\n");
rt_kprintf(" wice start wice\n");
rt_kprintf(" wice -s start wice\n");
}
int cnt;
int time_delay;
int force_stop;
static void wice_auto_test(void)
{
while (cnt--)
{
if (force_stop)
{
break;
}
rt_thread_startup(rt_thread_create("wifi", (void (*)(void *))wice_create, NULL, 8192, 10, 0));
rt_thread_delay(time_delay);
rt_thread_startup(rt_thread_create("wifi", (void (*)(void *))wice_delete, NULL, 8192, 10, 0));
rt_thread_delay(time_delay);
}
}
int wice_cmd(int argc, char *argv[])
{
if (argc == 1)
{
rt_thread_startup(rt_thread_create("wifi", (void (*)(void *))wice_create, NULL, 8192, 10, 0));
}
else if (argc == 2)
{
if (strcmp(argv[1], "-c") == 0)
{
rt_thread_startup(rt_thread_create("wifi", (void (*)(void *))wice_create, NULL, 8192, 10, 0));
}
else if (strcmp(argv[1], "-d") == 0)
{
rt_thread_startup(rt_thread_create("wifi", (void (*)(void *))wice_delete, NULL, 8192, 10, 0));
}
else if (strcmp(argv[1], "-a") == 0)
{
cnt = -1;
time_delay = 10000;
force_stop = 0;
rt_thread_startup(rt_thread_create("wifi", (void (*)(void *))wice_auto_test, NULL, 8192, 10, 0));
}
else if (strcmp(argv[1], "-q") == 0)
{
force_stop = 1;
}
else if (strcmp(argv[1], "-s") == 0)
{
rk_wifi_smartconfig();
}
else if (strcmp(argv[1], "-e") == 0)
{
rk_smartconfig_stop();
}
else if (strcmp(argv[1], "-g") == 0)
{
WIFI_AP *ap;
ap = rk_wifi_smartconfig_get();
if (ap)
{
ap->ap_ssid_value[ap->ap_ssid_len] = 0;
rt_kprintf("ssid: %s\n", ap->ap_ssid_value);
ap->security_key[ap->security_key_length] = 0;
rt_kprintf("password: %s\n", ap->security_key);
}
}
else if (strcmp(argv[1], "-h") == 0)
{
usage();
}
else
{
usage();
}
}
else
{
usage();
}
return 0;
}
#ifdef RT_USING_FINSH
#include <finsh.h>
MSH_CMD_EXPORT_ALIAS(wice_cmd, wice, start wice wlan driver);
#endif
#endif
#ifdef RT_USING_WICE_MFG_TEST
extern void mfgcmd(char *pstr);
int wl(int argc, char *argv[])
{
int len;
if (argc == 1)
{
return 0;
}
char *buf = malloc(1024);
memset(buf, 0, 1024);
len = 0;
for (int i = 1; i < argc; i++)
{
memcpy(buf + len, argv[i], strlen(argv[i]));
len += strlen(argv[i]);
buf[len] = 0x20;
len++;
}
buf[len - 1] = 0;
mfgcmd(buf + 3);
return 0;
}
#ifdef RT_USING_FINSH
#include <finsh.h>
MSH_CMD_EXPORT_ALIAS(wl, wl, rkos cmd wifi factory test);
#endif
#endif