mirror of
https://github.com/dgoodlad/rtl8710-sdk.git
synced 2024-12-04 20:10:28 +00:00
Build the vendored SDK
This commit is contained in:
parent
7319ca1482
commit
f737e1c4ab
10 changed files with 1602 additions and 0 deletions
|
@ -5,3 +5,9 @@ authors = ["David Goodlad <david@goodlad.net>"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
cty = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
cc = { version = "1.0", features = ["parallel"] }
|
||||
bindgen = "0.49.0"
|
||||
llvm-tools = "0.1.1"
|
||||
|
|
307
build.rs
Normal file
307
build.rs
Normal file
|
@ -0,0 +1,307 @@
|
|||
extern crate bindgen;
|
||||
extern crate cc;
|
||||
extern crate llvm_tools;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
use llvm_tools::LlvmTools;
|
||||
|
||||
const STDLIB_INCLUDE_PATHS: &[&'static str] = &[
|
||||
"/usr/lib/gcc/arm-none-eabi/5.4.1/include",
|
||||
"/usr/lib/gcc/arm-none-eabi/5.4.1/include-fixed",
|
||||
"/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/include",
|
||||
];
|
||||
|
||||
const SDK_INCLUDE_PATHS: &[&'static str] = &[
|
||||
"vendor/sdk/component/soc/realtek/common/bsp",
|
||||
"vendor/sdk/component/os/freertos",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/include",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3",
|
||||
"vendor/sdk/component/os/os_dep/include",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/driver",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/os",
|
||||
"vendor/sdk/component/common/api/network/include",
|
||||
"vendor/sdk/component/common/api",
|
||||
"vendor/sdk/component/common/api/platform",
|
||||
"vendor/sdk/component/common/api/wifi",
|
||||
"vendor/sdk/component/common/api/wifi/rtw_wpa_supplicant/src",
|
||||
"vendor/sdk/component/common/mbed/api",
|
||||
"vendor/sdk/component/common/mbed/hal",
|
||||
"vendor/sdk/component/common/mbed/hal_ext",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a",
|
||||
"vendor/sdk/component/common/file_system",
|
||||
"vendor/sdk/component/common/network",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/include",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/include/lwip",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/include/ipv4",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek",
|
||||
"vendor/sdk/component/common/test",
|
||||
"vendor/sdk/component/soc/realtek/8195a/cmsis",
|
||||
"vendor/sdk/component/soc/realtek/8195a/cmsis/device",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/platform",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/rtl_std_lib/include",
|
||||
"vendor/sdk/component/common/drivers/wlan/realtek/include",
|
||||
"vendor/sdk/component/common/drivers/wlan/realtek/src/osdep",
|
||||
"vendor/sdk/component/common/drivers/wlan/realtek/src/hci",
|
||||
"vendor/sdk/component/common/drivers/wlan/realtek/src/hal",
|
||||
"vendor/sdk/component/common/drivers/wlan/realtek/src/hal/OUTSRC",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/ram_lib/wlan/realtek/wlan_ram_map/rom",
|
||||
"vendor/sdk/component/common/network/ssl/polarssl-1.3.8/include",
|
||||
"vendor/sdk/component/common/network/ssl/ssl_ram_map/rom",
|
||||
"vendor/sdk/component/common/utilities",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/rtl_std_lib/include",
|
||||
"vendor/sdk/component/common/application/apple/WACServer/External/Curve25519",
|
||||
"vendor/sdk/component/common/application/apple/WACServer/External/GladmanAES",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include",
|
||||
"vendor/sdk/component/common/video/v4l2/inc",
|
||||
"vendor/sdk/component/common/media/rtp_codec",
|
||||
"vendor/sdk/component/common/drivers/usb_class/host/uvc/inc",
|
||||
"vendor/sdk/component/common/drivers/usb_class/device",
|
||||
"vendor/sdk/component/common/drivers/usb_class/device/class",
|
||||
"vendor/sdk/component/common/drivers/sdio/realtek/sdio_host/inc",
|
||||
"vendor/sdk/component/common/audio",
|
||||
"vendor/sdk/component/common/drivers/i2s",
|
||||
"vendor/sdk/component/common/application/xmodem",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTClient",
|
||||
];
|
||||
|
||||
const SDK_C_FILES: &[&'static str] = &[
|
||||
//cmsis
|
||||
"vendor/sdk/component/soc/realtek/8195a/cmsis/device/system_8195a.c",
|
||||
//console
|
||||
"vendor/sdk/component/common/api/at_cmd/atcmd_cloud.c",
|
||||
"vendor/sdk/component/common/api/at_cmd/atcmd_ethernet.c",
|
||||
"vendor/sdk/component/common/api/at_cmd/atcmd_lwip.c",
|
||||
"vendor/sdk/component/common/api/at_cmd/atcmd_sys.c",
|
||||
"vendor/sdk/component/common/api/at_cmd/atcmd_wifi.c",
|
||||
"vendor/sdk/component/common/api/at_cmd/log_service.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/driver/low_level_io.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/driver/rtl_consol.c",
|
||||
//network - api
|
||||
"vendor/sdk/component/common/api/wifi/rtw_wpa_supplicant/src/crypto/tls_polarssl.c",
|
||||
"vendor/sdk/component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_eap_config.c",
|
||||
"vendor/sdk/component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_p2p_config.c",
|
||||
"vendor/sdk/component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_wps_config.c",
|
||||
"vendor/sdk/component/common/api/wifi/wifi_conf.c",
|
||||
"vendor/sdk/component/common/api/wifi/wifi_ind.c",
|
||||
"vendor/sdk/component/common/api/wifi/wifi_promisc.c",
|
||||
"vendor/sdk/component/common/api/wifi/wifi_simple_config.c",
|
||||
"vendor/sdk/component/common/api/wifi/wifi_util.c",
|
||||
"vendor/sdk/component/common/api/lwip_netconf.c",
|
||||
//network - app
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTClient/MQTTClient.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTConnectClient.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTConnectServer.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTDeserializePublish.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTFormat.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTClient/MQTTFreertos.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTPacket.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTSerializePublish.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTSubscribeClient.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTSubscribeServer.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeClient.c",
|
||||
"vendor/sdk/component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeServer.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/platform/ota_8195a.c",
|
||||
"vendor/sdk/component/common/api/network/src/ping_test.c",
|
||||
"vendor/sdk/component/common/utilities/ssl_client.c",
|
||||
"vendor/sdk/component/common/utilities/ssl_client_ext.c",
|
||||
"vendor/sdk/component/common/utilities/tcptest.c",
|
||||
"vendor/sdk/component/common/api/network/src/wlan_network.c",
|
||||
//network - lwip
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/api_lib.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/api_msg.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/err.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/netbuf.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/netdb.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/netifapi.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/sockets.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/api/tcpip.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/autoip.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/icmp.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/igmp.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/inet.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/inet_chksum.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip_addr.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip_frag.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/def.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/dhcp.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/dns.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/init.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/lwip_timers.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/mem.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/memp.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/netif.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/pbuf.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/raw.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/stats.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/sys.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/tcp.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/tcp_in.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/tcp_out.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/core/udp.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/src/netif/etharp.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos/ethernetif.c",
|
||||
"vendor/sdk/component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c",
|
||||
"vendor/sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos/sys_arch.c",
|
||||
"vendor/sdk/component/common/network/dhcp/dhcps.c",
|
||||
"vendor/sdk/component/common/network/sntp/sntp.c",
|
||||
//network - httpc
|
||||
"vendor/sdk/component/common/network/httpc/httpc_tls.c",
|
||||
//network - httpd
|
||||
"vendor/sdk/component/common/network/httpd/httpd_tls.c",
|
||||
//network - mdns
|
||||
"vendor/sdk/component/common/network/mDNS/mDNSPlatform.c",
|
||||
//network - wsclient
|
||||
"vendor/sdk/component/common/network/websocket/wsclient_tls.c",
|
||||
//os - freertos
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_5.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3/port.c",
|
||||
"vendor/sdk/component/os/freertos/cmsis_os.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/croutine.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/event_groups.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/list.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/queue.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/tasks.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_v8.1.2/Source/timers.c",
|
||||
//os - osdep
|
||||
"vendor/sdk/component/os/os_dep/device_lock.c",
|
||||
"vendor/sdk/component/os/freertos/freertos_service.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/os/mailbox.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/misc/os/osdep_api.c",
|
||||
"vendor/sdk/component/os/os_dep/osdep_service.c",
|
||||
"vendor/sdk/component/os/os_dep/tcm_heap.c",
|
||||
//peripheral - api
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/analogin_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/dma_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/efuse_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/ethernet_api.c",
|
||||
"vendor/sdk/component/common/drivers/ethernet_mii/ethernet_mii.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/flash_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/gpio_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/gpio_irq_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/i2c_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/i2s_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/log_uart_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/nfc_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/pinmap.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/pinmap_common.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/port_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/pwmout_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/rtc_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/serial_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/sleep.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/spdio_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/spi_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/sys_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/timer_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/us_ticker.c",
|
||||
"vendor/sdk/component/common/mbed/common/us_ticker_api.c",
|
||||
"vendor/sdk/component/common/mbed/common/wait_api.c",
|
||||
"vendor/sdk/component/common/mbed/targets/hal/rtl8195a/wdt_api.c",
|
||||
//peripheral - hal
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_32k.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_adc.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_gdma.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_gpio.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_i2c.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_i2s.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_mii.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_nfc.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_pcm.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_pwm.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_sdr_controller.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_ssi.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_timer.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/src/hal_uart.c",
|
||||
//peripheral - rtl8195a
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_adc.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_gdma.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_gpio.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_i2c.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_i2s.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_mii.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_nfc.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_pwm.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_timer.c",
|
||||
"vendor/sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_uart.c",
|
||||
//all:SRC_C += vendor/sdk/component/common/drivers/wlan/realtek/src/core/option/rtw_opt_skbuf.c
|
||||
"vendor/sdk/component/common/utilities/cJSON.c",
|
||||
"vendor/sdk/component/common/utilities/http_client.c",
|
||||
"vendor/sdk/component/common/utilities/uart_socket.c",
|
||||
"vendor/sdk/component/common/utilities/webserver.c",
|
||||
"vendor/sdk/component/common/utilities/xml.c",
|
||||
];
|
||||
|
||||
fn main() {
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
|
||||
let tools = LlvmTools::new().unwrap();
|
||||
let objcopy = match tools.tool("llvm-objcopy") {
|
||||
Some(path) => path,
|
||||
None => panic!("Couldn't find objcopy"),
|
||||
};
|
||||
|
||||
Command::new(objcopy)
|
||||
.args(&["--rename-section", ".data=.loader.data,contents,alloc,load,readonly,data"])
|
||||
.args(&["-I", "binary"])
|
||||
.args(&["-B", "arm"])
|
||||
.arg("vendor/sdk/component/soc/realtek/8195a/misc/bsp/image/ram_1.r.bin")
|
||||
.arg(out_path.join("ram_1.r.o"))
|
||||
.status().unwrap();
|
||||
|
||||
let mut compiler = cc::Build::new();
|
||||
|
||||
compiler
|
||||
.include("include")
|
||||
.define("M3", None)
|
||||
.define("CONFIG_PLATFORM_8195A", None)
|
||||
.define("GCC_ARMCM3", None)
|
||||
.define("F_CPU", "166000000L")
|
||||
.flag("-mcpu=cortex-m3")
|
||||
.flag("-mthumb")
|
||||
.flag("-g2")
|
||||
.flag("-w")
|
||||
.flag("-O2")
|
||||
.flag("-Wno-pointer-sign")
|
||||
.flag("-fno-common")
|
||||
.flag("-fmessage-length=0")
|
||||
.flag("-ffunction-sections")
|
||||
.flag("-fdata-sections")
|
||||
.flag("-fomit-frame-pointer")
|
||||
.flag("-fno-short-enums")
|
||||
.flag("-std=gnu99")
|
||||
.flag("-fsigned-char");
|
||||
|
||||
for path in STDLIB_INCLUDE_PATHS {
|
||||
compiler.include(path);
|
||||
}
|
||||
|
||||
for path in SDK_INCLUDE_PATHS {
|
||||
compiler.include(path);
|
||||
}
|
||||
|
||||
compiler
|
||||
.object(out_path.join("ram_1.r.o"))
|
||||
.files(SDK_C_FILES)
|
||||
.file("src/freertos_rs.c")
|
||||
.compile("sdk");
|
||||
|
||||
println!("cargo:rustc-link-search=native=vendor/sdk/component/soc/realtek/8195a/misc/bsp/lib/common/GCC/");
|
||||
println!("cargo:rustc-link-lib=sdk");
|
||||
println!("cargo:rustc-link-lib=_platform");
|
||||
println!("cargo:rustc-link-lib=_wlan");
|
||||
println!("cargo:rustc-link-lib=_http");
|
||||
println!("cargo:rustc-link-lib=_dct");
|
||||
println!("cargo:rustc-link-lib=_wps");
|
||||
println!("cargo:rustc-link-lib=_rtlstd");
|
||||
println!("cargo:rustc-link-lib=_websocket");
|
||||
println!("cargo:rustc-link-lib=_xmodem");
|
||||
println!("cargo:rustc-link-lib=_mdns");
|
||||
}
|
205
include/FreeRTOSConfig.h
Normal file
205
include/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, training, latest versions, license
|
||||
and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||
#define configTICK_RATE_HZ ( ( uint32_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
|
||||
#ifdef CONFIG_UVC
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 110 * 1024 ) ) // use HEAP5
|
||||
#else
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) ) // use HEAP5
|
||||
#endif
|
||||
#define configMAX_TASK_NAME_LEN ( 10 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 0
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TIMERS 1
|
||||
|
||||
#define configMAX_PRIORITIES ( 11 )
|
||||
#define PRIORITIE_OFFSET ( 4 )
|
||||
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#if configGENERATE_RUN_TIME_STATS
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //( ulHighFrequencyTimerTicks = 0UL )
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xTickCount //ulHighFrequencyTimerTicks
|
||||
#undef configUSE_TRACE_FACILITY
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define portCONFIGURE_STATS_PEROID_VALUE 1000 //unit Ticks
|
||||
#endif
|
||||
|
||||
#define configTIMER_TASK_PRIORITY ( 1 )
|
||||
#define configTIMER_QUEUE_LENGTH ( 10 )
|
||||
#define configTIMER_TASK_STACK_DEPTH ( 512 ) //USE_MIN_STACK_SIZE modify from 512 to 256
|
||||
|
||||
#if (__IASMARM__ != 1)
|
||||
|
||||
extern void freertos_pre_sleep_processing(unsigned int *expected_idle_time);
|
||||
extern void freertos_post_sleep_processing(unsigned int *expected_idle_time);
|
||||
extern int freertos_ready_to_sleep();
|
||||
|
||||
/* Enable tickless power saving. */
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
|
||||
/* In wlan usage, this value is suggested to use value less than 80 milliseconds */
|
||||
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
|
||||
|
||||
/* It's magic trick that let us can use our own sleep function */
|
||||
#define configPRE_SLEEP_PROCESSING( x ) ( freertos_pre_sleep_processing(&x) )
|
||||
|
||||
#define configPOST_SLEEP_PROCESSING( x ) ( freertos_post_sleep_processing(&x) )
|
||||
|
||||
/* It's magic trick that let us can enable/disable tickless dynamically */
|
||||
#define traceLOW_POWER_IDLE_BEGIN(); do { \
|
||||
if (!freertos_ready_to_sleep()) { \
|
||||
mtCOVERAGE_TEST_MARKER(); \
|
||||
break; \
|
||||
}
|
||||
|
||||
// portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
|
||||
|
||||
#define traceLOW_POWER_IDLE_END(); } while (0);
|
||||
|
||||
/* It's FreeRTOS related feature but it's not included in FreeRTOS design. */
|
||||
#define configUSE_WAKELOCK_PMU 1
|
||||
|
||||
#endif // #if (__IASMARM__ != 1)
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_pcTaskGetTaskName 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* Cortex-M specific definitions. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 4 /* 15 priority levels */
|
||||
#endif
|
||||
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
//#define RTK_MODE_TIMER
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
7
include/build_info.h
Normal file
7
include/build_info.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#define UTS_VERSION "2019/04/21-23:43:47"
|
||||
#define RTL8195AFW_COMPILE_TIME "2019/04/21-23:43:47"
|
||||
#define RTL8195AFW_COMPILE_DATE "20190421"
|
||||
#define RTL8195AFW_COMPILE_BY "dgoodlad"
|
||||
#define RTL8195AFW_COMPILE_HOST ""
|
||||
#define RTL8195AFW_COMPILE_DOMAIN "brunswick.dg.gl"
|
||||
#define RTL195AFW_COMPILER "gcc 5.4.1"
|
128
include/main.h
Normal file
128
include/main.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include <autoconf.h>
|
||||
|
||||
#ifndef CONFIG_WLAN
|
||||
#define CONFIG_WLAN 1
|
||||
#endif
|
||||
|
||||
/* Header file declaration*/
|
||||
void wlan_network();
|
||||
|
||||
/* Interactive Mode */
|
||||
#define SERIAL_DEBUG_RX 1
|
||||
|
||||
/* WLAN and Netork */
|
||||
#define STA_MODE_SSID "ap" /* Set SSID here */
|
||||
#define AP_MODE_SSID "wlan_ap_ssid" /* Set SSID here */
|
||||
#define AP_DEFAULT_CH 6
|
||||
#define WLAN0_NAME "wlan0"
|
||||
#define WLAN1_NAME "wlan1"
|
||||
#define WPA_PASSPHRASE "1234567890" /* Max 32 cahracters */
|
||||
#define WEP40_KEY {0x12, 0x34, 0x56, 0x78, 0x90}
|
||||
|
||||
#define ATVER_1 1 // For First AT command
|
||||
#define ATVER_2 2 // For UART Module AT command
|
||||
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||
#define ATCMD_VER ATVER_2
|
||||
#elif CONFIG_EXAMPLE_SPI_ATCMD
|
||||
#define ATCMD_VER ATVER_2
|
||||
#else
|
||||
#define ATCMD_VER ATVER_1
|
||||
#endif
|
||||
|
||||
|
||||
#if ATCMD_VER == ATVER_2 || WIFI_LOGO_CERTIFICATION_CONFIG
|
||||
|
||||
extern unsigned char sta_ip[4], sta_netmask[4], sta_gw[4];
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define IP_ADDR0 sta_ip[0]
|
||||
#define IP_ADDR1 sta_ip[1]
|
||||
#define IP_ADDR2 sta_ip[2]
|
||||
#define IP_ADDR3 sta_ip[3]
|
||||
|
||||
/*NETMASK*/
|
||||
#define NETMASK_ADDR0 sta_netmask[0]
|
||||
#define NETMASK_ADDR1 sta_netmask[1]
|
||||
#define NETMASK_ADDR2 sta_netmask[2]
|
||||
#define NETMASK_ADDR3 sta_netmask[3]
|
||||
|
||||
/*Gateway Address*/
|
||||
#define GW_ADDR0 sta_gw[0]
|
||||
#define GW_ADDR1 sta_gw[1]
|
||||
#define GW_ADDR2 sta_gw[2]
|
||||
#define GW_ADDR3 sta_gw[3]
|
||||
|
||||
#else
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define IP_ADDR0 192
|
||||
#define IP_ADDR1 168
|
||||
#define IP_ADDR2 1
|
||||
#define IP_ADDR3 80
|
||||
|
||||
/*NETMASK*/
|
||||
#define NETMASK_ADDR0 255
|
||||
#define NETMASK_ADDR1 255
|
||||
#define NETMASK_ADDR2 255
|
||||
#define NETMASK_ADDR3 0
|
||||
|
||||
/*Gateway Address*/
|
||||
#define GW_ADDR0 192
|
||||
#define GW_ADDR1 168
|
||||
#define GW_ADDR2 1
|
||||
#define GW_ADDR3 1
|
||||
|
||||
#endif //#if ATCMD_VER == ATVER_2 || WIFI_LOGO_CERTIFICATION_CONFIG
|
||||
|
||||
#if ATCMD_VER == ATVER_2
|
||||
#undef CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 1
|
||||
|
||||
extern unsigned char ap_ip[4], ap_netmask[4], ap_gw[4];
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define AP_IP_ADDR0 ap_ip[0]
|
||||
#define AP_IP_ADDR1 ap_ip[1]
|
||||
#define AP_IP_ADDR2 ap_ip[2]
|
||||
#define AP_IP_ADDR3 ap_ip[3]
|
||||
|
||||
/*NETMASK*/
|
||||
#define AP_NETMASK_ADDR0 ap_netmask[0]
|
||||
#define AP_NETMASK_ADDR1 ap_netmask[1]
|
||||
#define AP_NETMASK_ADDR2 ap_netmask[2]
|
||||
#define AP_NETMASK_ADDR3 ap_netmask[3]
|
||||
|
||||
/*Gateway Address*/
|
||||
#define AP_GW_ADDR0 ap_gw[0]
|
||||
#define AP_GW_ADDR1 ap_gw[1]
|
||||
#define AP_GW_ADDR2 ap_gw[2]
|
||||
#define AP_GW_ADDR3 ap_gw[3]
|
||||
|
||||
#else
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define AP_IP_ADDR0 192
|
||||
#define AP_IP_ADDR1 168
|
||||
#define AP_IP_ADDR2 43
|
||||
#define AP_IP_ADDR3 1
|
||||
|
||||
/*NETMASK*/
|
||||
#define AP_NETMASK_ADDR0 255
|
||||
#define AP_NETMASK_ADDR1 255
|
||||
#define AP_NETMASK_ADDR2 255
|
||||
#define AP_NETMASK_ADDR3 0
|
||||
|
||||
/*Gateway Address*/
|
||||
#define AP_GW_ADDR0 192
|
||||
#define AP_GW_ADDR1 168
|
||||
#define AP_GW_ADDR2 43
|
||||
#define AP_GW_ADDR3 1
|
||||
|
||||
#endif //#if ATCMD_VER == ATVER_2
|
||||
|
||||
|
||||
#endif
|
213
include/platform_autoconf.h
Normal file
213
include/platform_autoconf.h
Normal file
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* Automatically generated by make menuconfig: don't edit
|
||||
*/
|
||||
#define AUTOCONF_INCLUDED
|
||||
|
||||
/*
|
||||
* Target Platform Selection
|
||||
*/
|
||||
#define CONFIG_WITHOUT_MONITOR 1
|
||||
|
||||
#undef CONFIG_RTL8195A
|
||||
#define CONFIG_RTL8195A 1
|
||||
#undef CONFIG_FPGA
|
||||
#undef CONFIG_RTL_SIM
|
||||
#undef CONFIG_POST_SIM
|
||||
|
||||
/*
|
||||
* < Mass Production Option
|
||||
*/
|
||||
#undef CONFIG_MP
|
||||
#undef CONFIG_CP
|
||||
#undef CONFIG_FT
|
||||
#define RTL8195A 1
|
||||
#define CONFIG_CPU_CLK 1
|
||||
#define CONFIG_CPU_166_6MHZ 1
|
||||
#undef CONFIG_CPU_83_3MHZ
|
||||
#undef CONFIG_CPU_41_6MHZ
|
||||
#undef CONFIG_CPU_20_8MHZ
|
||||
#undef CONFIG_CPU_10_4MHZ
|
||||
#undef CONFIG_CPU_4MHZ
|
||||
#undef CONFIG_FPGA_CLK
|
||||
#define PLATFORM_CLOCK (166666666)
|
||||
#define CPU_CLOCK_SEL_VALUE (0)
|
||||
#define CONFIG_SDR_CLK 1
|
||||
#define CONFIG_SDR_100MHZ 1
|
||||
#undef CONFIG_SDR_50MHZ
|
||||
#undef CONFIG_SDR_25MHZ
|
||||
#undef CONFIG_SDR_12_5MHZ
|
||||
#define SDR_CLOCK_SEL_VALUE (0)
|
||||
#define CONFIG_BOOT_PROCEDURE 1
|
||||
#define CONFIG_IMAGE_PAGE_LOAD 1
|
||||
#undef CONFIG_IMAGE_AUTO_LOAD
|
||||
//#undef CONFIG_IMAGE_PAGE_LOAD
|
||||
//#define CONFIG_IMAGE_AUTO_LOAD 1
|
||||
#define CONFIG_BOOT_TO_UPGRADE_IMG2 1
|
||||
#undef CONFIG_PERI_UPDATE_IMG
|
||||
#define CONFIG_BOOT_FROM_JTAG 1
|
||||
#undef CONFIG_ALIGNMENT_EXCEPTION_ENABLE
|
||||
#define CONFIG_KERNEL 1
|
||||
#define PLATFORM_FREERTOS 1
|
||||
#undef PLATFORM_UCOSII
|
||||
#undef PLATFORM_ECOS
|
||||
#undef CONFIG_TASK_SCHEDUL_DIS
|
||||
#define TASK_SCHEDULER_DISABLED (0)
|
||||
#define CONFIG_NORMALL_MODE 1
|
||||
#undef CONFIG_MEMORY_VERIFY_MODE
|
||||
#define CONFIG_TIMER_EN 1
|
||||
#define CONFIG_TIMER_NORMAL 1
|
||||
#undef CONFIG_TIMER_TEST
|
||||
#define CONFIG_TIMER_MODULE 1
|
||||
#define CONFIG_WDG 1
|
||||
#undef CONFIG_WDG_NON
|
||||
#define CONFIG_WDG_NORMAL 1
|
||||
#define CONFIG_GDMA_EN 1
|
||||
#define CONFIG_GDMA_NORMAL 1
|
||||
#undef CONFIG_GDMA_TEST
|
||||
#define CONFIG_GDMA_MODULE 1
|
||||
#define CONFIG_WIFI_EN 1
|
||||
#define CONFIG_WIFI_NORMAL 1
|
||||
#undef CONFIG_WIFI_TEST
|
||||
#define CONFIG_WIFI_MODULE 1
|
||||
#define CONFIG_GPIO_EN 1
|
||||
#define CONFIG_GPIO_NORMAL 1
|
||||
#undef CONFIG_GPIO_TEST
|
||||
#define CONFIG_GPIO_MODULE 1
|
||||
#if defined(CONFIG_INIC) || (CONFIG_SDIOD)
|
||||
#define CONFIG_SDIO_DEVICE_EN 1
|
||||
#define CONFIG_SDIO_DEVICE_NORMAL 1
|
||||
#undef CONFIG_SDIO_DEVICE_TEST
|
||||
#define CONFIG_SDIO_DEVICE_MODULE 1
|
||||
#else
|
||||
#undef CONFIG_SDIO_DEVICE_EN
|
||||
#endif
|
||||
#define CONFIG_SDIO_HOST_EN 1
|
||||
#define CONFIG_USB_EN 1
|
||||
#undef CONFIG_USB_NORMAL
|
||||
#define CONFIG_USB_TEST 1
|
||||
#define CONFIG_USB_MODULE 1
|
||||
#define CONFIG_USB_VERIFY 1
|
||||
#undef CONFIG_USB_ROM_LIB
|
||||
//#define CONFIG_USB_DBGINFO_EN 1
|
||||
#if defined(CONFIG_INIC) || (CONFIG_USBD)
|
||||
#define DWC_DEVICE_ONLY 1
|
||||
#else
|
||||
#define DWC_HOST_ONLY 1
|
||||
#define CONFIG_USB_HOST_ONLY 1
|
||||
#endif
|
||||
#define CONFIG_SPI_COM_EN 1
|
||||
#define CONFIG_SPI_COM_NORMAL 1
|
||||
#undef CONFIG_SPI_COM_TEST
|
||||
#define CONFIG_SPI_COM_MODULE 1
|
||||
#define CONFIG_UART_EN 1
|
||||
#define CONFIG_UART_NORMAL 1
|
||||
#undef CONFIG_UART_TEST
|
||||
#define CONFIG_UART_MODULE 1
|
||||
#define CONFIG_I2C_EN 1
|
||||
#define CONFIG_I2C_NORMAL 1
|
||||
#undef CONFIG_I2C_TEST
|
||||
#define CONFIG_I2C_MODULE 1
|
||||
#undef CONFIG_DEBUG_LOG_I2C_HAL
|
||||
#undef CONFIG_PCM_EN
|
||||
#define CONFIG_I2S_EN 1
|
||||
#define CONFIG_I2S_NORMAL 1
|
||||
#undef CONFIG_I2S_TEST
|
||||
#define CONFIG_I2S_MODULE 1
|
||||
#undef CONFIG_DEBUG_LOG_I2S_HAL
|
||||
#define CONFIG_NFC_EN 1
|
||||
#define CONFIG_NFC_NORMAL 1
|
||||
#undef CONFIG_NFC_TEST
|
||||
#define CONFIG_NFC_MODULE 1
|
||||
#define CONFIG_SOC_PS_EN 1
|
||||
#define CONFIG_SOC_PS_NORMAL 1
|
||||
#undef CONFIG_SOC_PS_TEST
|
||||
#define CONFIG_SOC_PS_MODULE 1
|
||||
#define CONFIG_CRYPTO_EN 1
|
||||
#define CONFIG_CRYPTO_NORMAL 1
|
||||
#undef CONFIG_CRYPTO_TEST
|
||||
#define CONFIG_CRYPTO_MODULE 1
|
||||
#define CONFIG_MII_EN 1
|
||||
#define CONFIG_PWM_EN 1
|
||||
#define CONFIG_PWM_NORMAL 1
|
||||
#undef CONFIG_PWM_TEST
|
||||
#define CONFIG_PWM_MODULE 1
|
||||
#define CONFIG_EFUSE_EN 1
|
||||
#define CONFIG_EFUSE_NORMAL 1
|
||||
#undef CONFIG_EFUSE_TEST
|
||||
#define CONFIG_EFUSE_MODULE 1
|
||||
#define CONFIG_SDR_EN 1
|
||||
#define CONFIG_SDR_NORMAL 1
|
||||
#undef CONFIG_SDR_TEST
|
||||
#define CONFIG_SDR_MODULE 1
|
||||
#define CONFIG_SPIC_EN 1
|
||||
#define CONFIG_SPIC_NORMAL 1
|
||||
#undef CONFIG_SPIC_TEST
|
||||
#define CONFIG_SPIC_MODULE 1
|
||||
#define CONFIG_ADC_EN 1
|
||||
#define CONFIG_DAC_EN 1
|
||||
#define CONFIG_NOR_FLASH 1
|
||||
#undef CONFIG_SPI_FLASH
|
||||
#undef CONFIG_NAND_FLASH
|
||||
#undef CONFIG_NONE_FLASH
|
||||
#undef CONFIG_BTBX_EN
|
||||
|
||||
/*
|
||||
* < Engineer Mode Config
|
||||
*/
|
||||
#undef CONFIG_JTAG
|
||||
#undef CONFIG_COMPILE_FLASH_DOWNLOAD_CODE
|
||||
#undef CONIFG_COMPILE_EXTERNAL_SRAM_CALIBRATE
|
||||
#undef CONFIG_CMSIS_MATH_LIB_EN
|
||||
|
||||
/*
|
||||
* < Application Config
|
||||
*/
|
||||
#define CONFIG_NETWORK 1
|
||||
#define CONFIG_RTLIB_EN 1
|
||||
#define CONFIG_RTLIB_NORMAL 1
|
||||
#undef CONFIG_RTLIB_TEST
|
||||
#define CONFIG_RTLIB_MODULE 1
|
||||
|
||||
/*
|
||||
* < System Debug Message Config
|
||||
*/
|
||||
#define CONFIG_UART_LOG_HISTORY 1
|
||||
#undef CONFIG_CONSOLE_NORMALL_MODE
|
||||
#define CONFIG_CONSOLE_VERIFY_MODE 1
|
||||
#define CONFIG_DEBUG_LOG 1
|
||||
#define CONFIG_DEBUG_ERR_MSG 1
|
||||
#undef CONFIG_DEBUG_WARN_MSG
|
||||
#undef CONFIG_DEBUG_INFO_MSG
|
||||
|
||||
/*
|
||||
* < SDK Option Config
|
||||
*/
|
||||
#undef CONFIG_MBED_ENABLED
|
||||
#undef CONFIG_APP_DEMO
|
||||
|
||||
/*
|
||||
* < Select Chip Version
|
||||
*/
|
||||
#undef CONFIG_CHIP_A_CUT
|
||||
#define CONFIG_CHIP_B_CUT 1
|
||||
#undef CONFIG_CHIP_C_CUT
|
||||
#undef CONFIG_CHIP_E_CUT
|
||||
|
||||
/*
|
||||
* < Select toolchain
|
||||
*/
|
||||
#undef CONFIG_TOOLCHAIN_ASDK
|
||||
#undef CONFIG_TOOLCHAIN_ARM_GCC
|
||||
|
||||
/*
|
||||
* < Build Option
|
||||
*/
|
||||
#define CONFIG_LINK_ROM_LIB 1
|
||||
#undef CONFIG_LINK_ROM_SYMB
|
||||
#undef CONFIG_NORMAL_BUILD
|
||||
#undef CONFIG_RELEASE_BUILD
|
||||
#undef CONFIG_RELEASE_BUILD_LIBRARIES
|
||||
#undef CONFIG_LIB_BUILD_RAM
|
||||
#define CONFIG_RELEASE_BUILD_RAM_ALL 1
|
||||
#undef CONFIG_IMAGE_ALL
|
||||
#define CONFIG_IMAGE_SEPARATE 1
|
346
include/platform_opts.h
Normal file
346
include/platform_opts.h
Normal file
|
@ -0,0 +1,346 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
*This file contains general configurations for ameba platform
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_OPTS_H__
|
||||
#define __PLATFORM_OPTS_H__
|
||||
|
||||
/*For MP mode setting*/
|
||||
#define SUPPORT_MP_MODE 0
|
||||
|
||||
/**
|
||||
* For AT cmd Log service configurations
|
||||
*/
|
||||
#define SUPPORT_LOG_SERVICE 1
|
||||
#if SUPPORT_LOG_SERVICE
|
||||
#define LOG_SERVICE_BUFLEN 100 //can't larger than UART_LOG_CMD_BUFLEN(127)
|
||||
#define CONFIG_LOG_HISTORY 0
|
||||
#if CONFIG_LOG_HISTORY
|
||||
#define LOG_HISTORY_LEN 5
|
||||
#endif
|
||||
#define SUPPORT_INTERACTIVE_MODE 0//on/off wifi_interactive_mode
|
||||
#define CONFIG_LOG_SERVICE_LOCK 0
|
||||
#if SUPPORT_MP_MODE
|
||||
#define CONFIG_ATCMD_MP 1 //support MP AT command
|
||||
#endif
|
||||
#define USE_MODE 1 //for test
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For interactive mode configurations, depends on log service
|
||||
*/
|
||||
#if SUPPORT_INTERACTIVE_MODE
|
||||
#define CONFIG_INTERACTIVE_MODE 1
|
||||
#define CONFIG_INTERACTIVE_EXT 0
|
||||
#else
|
||||
#define CONFIG_INTERACTIVE_MODE 0
|
||||
#define CONFIG_INTERACTIVE_EXT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For FreeRTOS tickless configurations
|
||||
*/
|
||||
#define FREERTOS_PMU_TICKLESS_PLL_RESERVED 0 // In sleep mode, 0: close PLL clock, 1: reserve PLL clock
|
||||
#define FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM 1 // In sleep mode, 1: suspend SDRAM, 0: no act
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* For common flash usage
|
||||
*/
|
||||
#define AP_SETTING_SECTOR 0x000FE000
|
||||
#define UART_SETTING_SECTOR 0x000FC000
|
||||
#define FAST_RECONNECT_DATA (0x80000 - 0x1000)
|
||||
#define FLASH_SECTOR_SIZE 0x1000
|
||||
|
||||
/**
|
||||
* For Wlan configurations
|
||||
*/
|
||||
#define CONFIG_WLAN 1
|
||||
#if CONFIG_WLAN
|
||||
#define CONFIG_LWIP_LAYER 1
|
||||
#define CONFIG_INIT_NET 1 //init lwip layer when start up
|
||||
#define CONFIG_WIFI_IND_USE_THREAD 0 // wifi indicate worker thread
|
||||
#if (SUPPORT_MP_MODE == 0)
|
||||
#define CONFIG_ENABLE_AP_POLLING_CLIENT_ALIVE 1 // on or off AP POLLING CLIENT
|
||||
#endif
|
||||
|
||||
//on/off relative commands in log service
|
||||
#define CONFIG_SSL_CLIENT 0
|
||||
#define CONFIG_WEBSERVER 0
|
||||
#define CONFIG_OTA_UPDATE 1
|
||||
#define CONFIG_BSD_TCP 0//NOTE : Enable CONFIG_BSD_TCP will increase about 11KB code size
|
||||
#define CONFIG_AIRKISS 0//on or off tencent airkiss
|
||||
#define CONFIG_UART_SOCKET 0
|
||||
#define CONFIG_AIRKISS_CLOUD 0//on or off for weixin hardware cloud
|
||||
#define CONFIG_UART_YMODEM 0//support uart ymodem upgrade or not
|
||||
#define CONFIG_TRANSPORT 0//on or off the at command for transport socket
|
||||
|
||||
/* For WPS and P2P */
|
||||
#define CONFIG_ENABLE_WPS 0
|
||||
#if CONFIG_ENABLE_WPS
|
||||
#define CONFIG_ENABLE_WPS_DISCOVERY 1
|
||||
#endif
|
||||
#if CONFIG_ENABLE_P2P
|
||||
#define CONFIG_ENABLE_WPS_AP 1
|
||||
#undef CONFIG_WIFI_IND_USE_THREAD
|
||||
#define CONFIG_WIFI_IND_USE_THREAD 1
|
||||
#endif
|
||||
#if (CONFIG_ENABLE_P2P && ((CONFIG_ENABLE_WPS_AP == 0) || (CONFIG_ENABLE_WPS == 0)))
|
||||
#error "If CONFIG_ENABLE_P2P, need to define CONFIG_ENABLE_WPS_AP 1"
|
||||
#endif
|
||||
|
||||
/* For SSL/TLS */
|
||||
#define CONFIG_USE_POLARSSL 1
|
||||
#define CONFIG_USE_MBEDTLS 0
|
||||
#if ((CONFIG_USE_POLARSSL == 0) && (CONFIG_USE_MBEDTLS == 0)) || ((CONFIG_USE_POLARSSL == 1) && (CONFIG_USE_MBEDTLS == 1))
|
||||
#undef CONFIG_USE_POLARSSL
|
||||
#define CONFIG_USE_POLARSSL 1
|
||||
#undef CONFIG_USE_MBEDTLS
|
||||
#define CONFIG_USE_MBEDTLS 0
|
||||
#endif
|
||||
|
||||
/* For Simple Link */
|
||||
#define CONFIG_INCLUDE_SIMPLE_CONFIG 0
|
||||
|
||||
/*For fast reconnection*/
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
|
||||
|
||||
#define CONFIG_GAGENT 0
|
||||
/*Disable CONFIG_EXAMPLE_WLAN_FAST_CONNECT when CONFIG_GAGENT is enabled,because
|
||||
reconnect to previous AP is not suitable when re-configuration.
|
||||
*/
|
||||
#if CONFIG_GAGENT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#endif
|
||||
|
||||
|
||||
#endif //end of #if CONFIG_WLAN
|
||||
/*******************************************************************************/
|
||||
|
||||
/**
|
||||
* For Ethernet configurations
|
||||
*/
|
||||
#define CONFIG_ETHERNET 0
|
||||
#if CONFIG_ETHERNET
|
||||
|
||||
#define CONFIG_LWIP_LAYER 1
|
||||
#define CONFIG_INIT_NET 1 //init lwip layer when start up
|
||||
|
||||
//on/off relative commands in log service
|
||||
#define CONFIG_SSL_CLIENT 0
|
||||
#define CONFIG_BSD_TCP 0//NOTE : Enable CONFIG_BSD_TCP will increase about 11KB code size
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* For iNIC configurations
|
||||
*/
|
||||
#ifdef CONFIG_INIC //this flag is defined in IAR project
|
||||
#define CONFIG_INIC_EN 1//enable iNIC mode
|
||||
#undef CONFIG_ENABLE_WPS
|
||||
#define CONFIG_ENABLE_WPS 1
|
||||
#undef CONFIG_INCLUDE_SIMPLE_CONFIG
|
||||
#define CONFIG_INCLUDE_SIMPLE_CONFIG 1
|
||||
#undef CONFIG_WOWLAN_SERVICE
|
||||
#define CONFIG_WOWLAN_SERVICE 1
|
||||
#undef LOG_SERVICE_BUFLEN
|
||||
#define LOG_SERVICE_BUFLEN 256
|
||||
#undef CONFIG_LWIP_LAYER
|
||||
#define CONFIG_LWIP_LAYER 0
|
||||
#undef CONFIG_OTA_UPDATE
|
||||
#define CONFIG_OTA_UPDATE 0
|
||||
#undef CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#define CONFIG_INIC_SDIO_HCI 1 //for SDIO or USB iNIC
|
||||
#define CONFIG_INIC_USB_HCI 0
|
||||
#define CONFIG_INIC_CMD_RSP 1 //need to return msg to host
|
||||
#endif
|
||||
/******************End of iNIC configurations*******************/
|
||||
|
||||
|
||||
/* For WIFI GET BEACON FRAME example */
|
||||
#define CONFIG_EXAMPLE_GET_BEACON_FRAME 0
|
||||
|
||||
/* For WIFI MAC MONITOR example */
|
||||
#define CONFIG_EXAMPLE_WIFI_MAC_MONITOR 0
|
||||
|
||||
/* For HTTP CLIENT example */
|
||||
#define CONFIG_EXAMPLE_HTTP_CLIENT 0
|
||||
|
||||
/* For MQTT example */
|
||||
#define CONFIG_EXAMPLE_MQTT 0
|
||||
|
||||
/* For mDNS example */
|
||||
#define CONFIG_EXAMPLE_MDNS 0
|
||||
|
||||
/* For multicast example */
|
||||
#define CONFIG_EXAMPLE_MCAST 0
|
||||
|
||||
/* For XML example */
|
||||
#define CONFIG_EXAMPLE_XML 0
|
||||
|
||||
/* For socket select example */
|
||||
#define CONFIG_EXAMPLE_SOCKET_SELECT 0
|
||||
|
||||
/* For socket nonblocking connect example */
|
||||
#define CONFIG_EXAMPLE_NONBLOCK_CONNECT 0
|
||||
|
||||
/* For socket TCP bidirectional transmission example */
|
||||
#define CONFIG_EXAMPLE_SOCKET_TCP_TRX 0
|
||||
|
||||
/* For ssl download example */
|
||||
#define CONFIG_EXAMPLE_SSL_DOWNLOAD 0
|
||||
|
||||
/* For http download example */
|
||||
#define CONFIG_EXAMPLE_HTTP_DOWNLOAD 0
|
||||
|
||||
/* For httpc example */
|
||||
#define CONFIG_EXAMPLE_HTTPC 0
|
||||
|
||||
/* For httpd example */
|
||||
#define CONFIG_EXAMPLE_HTTPD 0
|
||||
|
||||
/* For tcp keepalive example */
|
||||
#define CONFIG_EXAMPLE_TCP_KEEPALIVE 0
|
||||
|
||||
/* For sntp show time example */
|
||||
#define CONFIG_EXAMPLE_SNTP_SHOWTIME 0
|
||||
|
||||
|
||||
/* For websocket client example */
|
||||
#define CONFIG_EXAMPLE_WEBSOCKET 0
|
||||
|
||||
|
||||
/* For UART Module AT command example */
|
||||
#define CONFIG_EXAMPLE_UART_ATCMD 0
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||
#undef FREERTOS_PMU_TICKLESS_PLL_RESERVED
|
||||
#define FREERTOS_PMU_TICKLESS_PLL_RESERVED 1
|
||||
#undef CONFIG_OTA_UPDATE
|
||||
#define CONFIG_OTA_UPDATE 1
|
||||
#undef CONFIG_TRANSPORT
|
||||
#define CONFIG_TRANSPORT 1
|
||||
#undef LOG_SERVICE_BUFLEN
|
||||
#define LOG_SERVICE_BUFLEN 1600
|
||||
#undef CONFIG_LOG_SERVICE_LOCK
|
||||
#define CONFIG_LOG_SERVICE_LOCK 1
|
||||
#undef CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#endif
|
||||
|
||||
|
||||
/* For DCT example*/
|
||||
#define CONFIG_EXAMPLE_DCT 0
|
||||
|
||||
/****************** For EAP method example *******************/
|
||||
#define CONFIG_EXAMPLE_EAP 0
|
||||
|
||||
// on/off specified eap method
|
||||
#define CONFIG_ENABLE_PEAP 0
|
||||
#define CONFIG_ENABLE_TLS 0
|
||||
#define CONFIG_ENABLE_TTLS 0
|
||||
|
||||
// optional feature: whether to verify the cert of radius server
|
||||
#define ENABLE_EAP_SSL_VERIFY_SERVER 0
|
||||
|
||||
#if CONFIG_ENABLE_PEAP || CONFIG_ENABLE_TLS || CONFIG_ENABLE_TTLS
|
||||
#define CONFIG_ENABLE_EAP
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_ENABLE_TLS
|
||||
#define ENABLE_EAP_SSL_VERIFY_CLIENT 1
|
||||
#else
|
||||
#define ENABLE_EAP_SSL_VERIFY_CLIENT 0
|
||||
#endif
|
||||
/******************End of EAP configurations*******************/
|
||||
|
||||
/* For iNIC host example*/
|
||||
#ifdef CONFIG_INIC_GSPI_HOST //this flag is defined in IAR project
|
||||
#define CONFIG_EXAMPLE_INIC_GSPI_HOST 1
|
||||
#if CONFIG_EXAMPLE_INIC_GSPI_HOST
|
||||
|
||||
#define CONFIG_INIC_HOST 1
|
||||
|
||||
#undef CONFIG_WLAN
|
||||
#define CONFIG_WLAN 0
|
||||
#undef CONFIG_INCLUDE_SIMPLE_CONFIG
|
||||
#define CONFIG_INCLUDE_SIMPLE_CONFIG 0
|
||||
#undef CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#undef CONFIG_LWIP_LAYER
|
||||
#define CONFIG_LWIP_LAYER 1
|
||||
#undef CONFIG_BSD_TCP
|
||||
#define CONFIG_BSD_TCP 1
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*For uart update example*/
|
||||
#define CONFIG_UART_UPDATE 0
|
||||
#if CONFIG_UART_UPDATE
|
||||
#undef CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* For uart adapter example */
|
||||
/* Please also configure LWIP_UART_ADAPTER to 1
|
||||
in lwip_opt.h for support uart adapter*/
|
||||
#define CONFIG_EXAMPLE_UART_ADAPTER 0
|
||||
#if CONFIG_EXAMPLE_UART_ADAPTER
|
||||
#undef CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 1
|
||||
#undef CONFIG_EXAMPLE_MDNS
|
||||
#define CONFIG_EXAMPLE_MDNS 1
|
||||
#undef FREERTOS_PMU_TICKLESS_PLL_RESERVED
|
||||
#define FREERTOS_PMU_TICKLESS_PLL_RESERVED 1
|
||||
#endif
|
||||
#if CONFIG_JD_SMART
|
||||
#if (CONFIG_ENABLE_WPS == 1)
|
||||
#define CONFIG_ENABLE_WPS 0
|
||||
#endif
|
||||
#if (CONFIG_INCLUDE_SIMPLE_CONFIG == 1)
|
||||
#define CONFIG_INCLUDE_SIMPLE_CONFIG 0
|
||||
#endif
|
||||
#if (CONFIG_EXAMPLE_WLAN_FAST_CONNECT == 1)
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* For wifi scenarios example (Wi-Fi, WPS enrollee, P2P GO) */
|
||||
// also need to enable WPS and P2P
|
||||
#define CONFIG_EXAMPLE_WLAN_SCENARIO 0
|
||||
|
||||
/* For broadcast example */
|
||||
#define CONFIG_EXAMPLE_BCAST 0
|
||||
|
||||
/* For high-load memory use case memory usage */
|
||||
#define CONFIG_EXAMPLE_HIGH_LOAD_MEMORY_USE 0
|
||||
|
||||
/* For rarp example */
|
||||
#define CONFIG_EXAMPLE_RARP 0
|
||||
|
||||
/* For ssl server example */
|
||||
#define CONFIG_EXAMPLE_SSL_SERVER 0
|
||||
|
||||
|
||||
/* For ota update http example */
|
||||
#define CONFIG_EXAMPLE_OTA_HTTP 0
|
||||
|
||||
|
||||
#if CONFIG_ENABLE_WPS
|
||||
#define WPS_CONNECT_RETRY_COUNT 4
|
||||
#define WPS_CONNECT_RETRY_INTERVAL 5000 // in ms
|
||||
#endif
|
||||
|
||||
#define AUTO_RECONNECT_COUNT 8
|
||||
#define AUTO_RECONNECT_INTERVAL 5 // in sec
|
||||
|
||||
#endif
|
7
include/wrapper.h
Normal file
7
include/wrapper.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "device.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "wifi_conf.h"
|
381
src/freertos_rs.c
Normal file
381
src/freertos_rs.c
Normal file
|
@ -0,0 +1,381 @@
|
|||
/*
|
||||
FreeRTOS.rs shim library
|
||||
|
||||
Include headers relevant for your platform.
|
||||
|
||||
STM32 example:
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "main.h"
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "semphr.h"
|
||||
#include "timers.h"
|
||||
|
||||
uint8_t freertos_rs_sizeof(uint8_t _type) {
|
||||
switch (_type) {
|
||||
case 0:
|
||||
return sizeof(void*);
|
||||
break;
|
||||
case 1:
|
||||
return sizeof(char*);
|
||||
break;
|
||||
case 2:
|
||||
return sizeof(char);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
return sizeof(BaseType_t);
|
||||
break;
|
||||
case 11:
|
||||
return sizeof(UBaseType_t);
|
||||
break;
|
||||
case 12:
|
||||
return sizeof(TickType_t);
|
||||
break;
|
||||
|
||||
case 20:
|
||||
return sizeof(TaskHandle_t);
|
||||
break;
|
||||
case 21:
|
||||
return sizeof(QueueHandle_t);
|
||||
break;
|
||||
case 22:
|
||||
return sizeof(SemaphoreHandle_t);
|
||||
break;
|
||||
case 23:
|
||||
return sizeof(TaskFunction_t);
|
||||
break;
|
||||
case 24:
|
||||
return sizeof(TimerHandle_t);
|
||||
break;
|
||||
case 25:
|
||||
return sizeof(TimerCallbackFunction_t);
|
||||
break;
|
||||
|
||||
case 30:
|
||||
return sizeof(TaskStatus_t);
|
||||
break;
|
||||
case 31:
|
||||
return sizeof(eTaskState);
|
||||
break;
|
||||
case 32:
|
||||
return sizeof(unsigned long);
|
||||
break;
|
||||
case 33:
|
||||
return sizeof(unsigned short);
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if (INCLUDE_vTaskDelayUntil == 1)
|
||||
void freertos_rs_vTaskDelayUntil(TickType_t *pxPreviousWakeTime, TickType_t xTimeIncrement) {
|
||||
vTaskDelayUntil(pxPreviousWakeTime, xTimeIncrement);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (INCLUDE_vTaskDelay == 1)
|
||||
void freertos_rs_vTaskDelay(TickType_t xTicksToDelay) {
|
||||
vTaskDelay(xTicksToDelay);
|
||||
}
|
||||
#endif
|
||||
|
||||
TickType_t freertos_rs_xTaskGetTickCount() {
|
||||
return xTaskGetTickCount();
|
||||
}
|
||||
|
||||
#if (configUSE_TRACE_FACILITY == 1)
|
||||
UBaseType_t freertos_rs_get_system_state(TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime) {
|
||||
return uxTaskGetSystemState(pxTaskStatusArray, uxArraySize, pulTotalRunTime);
|
||||
}
|
||||
#endif
|
||||
|
||||
TickType_t freertos_rs_get_portTICK_PERIOD_MS() {
|
||||
return portTICK_PERIOD_MS;
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_get_number_of_tasks() {
|
||||
return uxTaskGetNumberOfTasks();
|
||||
}
|
||||
|
||||
#if (configUSE_RECURSIVE_MUTEXES == 1)
|
||||
QueueHandle_t freertos_rs_create_recursive_mutex() {
|
||||
return xSemaphoreCreateRecursiveMutex();
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_take_recursive_mutex(QueueHandle_t mutex, UBaseType_t max) {
|
||||
if (xSemaphoreTakeRecursive(mutex, max) == pdTRUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
UBaseType_t freertos_rs_give_recursive_mutex(QueueHandle_t mutex) {
|
||||
if (xSemaphoreGiveRecursive(mutex) == pdTRUE) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QueueHandle_t freertos_rs_create_mutex() {
|
||||
return xSemaphoreCreateMutex();
|
||||
}
|
||||
|
||||
QueueHandle_t freertos_rs_create_binary_semaphore() {
|
||||
return xSemaphoreCreateBinary();
|
||||
}
|
||||
|
||||
QueueHandle_t freertos_rs_create_counting_semaphore(UBaseType_t max, UBaseType_t initial) {
|
||||
return xSemaphoreCreateCounting(max, initial);
|
||||
}
|
||||
|
||||
void freertos_rs_delete_semaphore(QueueHandle_t semaphore) {
|
||||
vSemaphoreDelete(semaphore);
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_take_mutex(QueueHandle_t mutex, UBaseType_t max) {
|
||||
if (xSemaphoreTake(mutex, max) == pdTRUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_give_mutex(QueueHandle_t mutex) {
|
||||
if (xSemaphoreGive(mutex) == pdTRUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_take_semaphore_isr(QueueHandle_t semaphore, BaseType_t* xHigherPriorityTaskWoken) {
|
||||
if (xSemaphoreTakeFromISR(semaphore, xHigherPriorityTaskWoken) == pdTRUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_give_semaphore_isr(QueueHandle_t semaphore, BaseType_t* xHigherPriorityTaskWoken) {
|
||||
if (xSemaphoreGiveFromISR(semaphore, xHigherPriorityTaskWoken) == pdTRUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
UBaseType_t freertos_rs_spawn_task(TaskFunction_t entry_point, void* pvParameters, const char * const name, uint8_t name_len, uint16_t stack_size, UBaseType_t priority, TaskHandle_t* task_handle) {
|
||||
char c_name[configMAX_TASK_NAME_LEN] = {0};
|
||||
for (int i = 0; i < name_len; i++) {
|
||||
c_name[i] = name[i];
|
||||
|
||||
if (i == configMAX_TASK_NAME_LEN - 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BaseType_t ret = xTaskCreate(entry_point, c_name, stack_size, pvParameters, priority, task_handle);
|
||||
|
||||
if (ret != pdPASS) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
configASSERT(task_handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (INCLUDE_vTaskDelete == 1)
|
||||
void freertos_rs_delete_task(TaskHandle_t task) {
|
||||
vTaskDelete(task);
|
||||
}
|
||||
#endif
|
||||
|
||||
UBaseType_t freertos_rs_get_stack_high_water_mark(TaskHandle_t task) {
|
||||
#if (INCLUDE_uxTaskGetStackHighWaterMark == 1)
|
||||
return uxTaskGetStackHighWaterMark(task);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QueueHandle_t freertos_rs_queue_create(UBaseType_t queue_length, UBaseType_t item_size) {
|
||||
return xQueueCreate(queue_length, item_size);
|
||||
}
|
||||
|
||||
void freertos_rs_queue_delete(QueueHandle_t queue) {
|
||||
vQueueDelete(queue);
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_queue_send(QueueHandle_t queue, void* item, TickType_t max_wait) {
|
||||
if (xQueueSend(queue, item, max_wait ) != pdTRUE)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_queue_send_isr(QueueHandle_t queue, void* item, BaseType_t* xHigherPriorityTaskWoken) {
|
||||
if (xQueueSendFromISR(queue, item, xHigherPriorityTaskWoken) == pdTRUE) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
UBaseType_t freertos_rs_queue_receive(QueueHandle_t queue, void* item, TickType_t max_wait) {
|
||||
if ( xQueueReceive( queue, item, max_wait ) != pdTRUE )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void freertos_rs_isr_yield() {
|
||||
portYIELD();
|
||||
}
|
||||
|
||||
TickType_t freertos_rs_max_wait() {
|
||||
return portMAX_DELAY;
|
||||
}
|
||||
|
||||
#if (INCLUDE_pcTaskGetTaskName == 1)
|
||||
char* freertos_rs_task_get_name(TaskHandle_t task) {
|
||||
return pcTaskGetTaskName(task);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t freertos_rs_task_notify_take(uint8_t clear_count, TickType_t wait) {
|
||||
return ulTaskNotifyTake(clear_count == 1 ? pdTRUE : pdFALSE, wait);
|
||||
}
|
||||
|
||||
BaseType_t freertos_rs_task_notify_wait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait) {
|
||||
if (xTaskNotifyWait(ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait) == pdTRUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//eNotifyAction freertos_rs_task_notify_action(uint8_t action) {
|
||||
// switch (action) {
|
||||
// case 1:
|
||||
// return eSetBits;
|
||||
// case 2:
|
||||
// return eIncrement;
|
||||
// case 3:
|
||||
// return eSetValueWithOverwrite;
|
||||
// case 4:
|
||||
// return eSetValueWithoutOverwrite;
|
||||
// default:
|
||||
// return eNoAction;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//BaseType_t freertos_rs_task_notify(void* task, uint32_t value, uint8_t action) {
|
||||
// eNotifyAction eAction = freertos_rs_task_notify_action(action);
|
||||
//
|
||||
// BaseType_t v = xTaskNotify(task, value, eAction);
|
||||
// if (v != pdPASS) {
|
||||
// return 1;
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
//
|
||||
//BaseType_t freertos_rs_task_notify_isr(void* task, uint32_t value, uint8_t action, BaseType_t* xHigherPriorityTaskWoken) {
|
||||
// eNotifyAction eAction = freertos_rs_task_notify_action(action);
|
||||
//
|
||||
// BaseType_t v = xTaskNotifyFromISR(task, value, eAction, xHigherPriorityTaskWoken);
|
||||
// if (v != pdPASS) {
|
||||
// return 1;
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
#if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
|
||||
TaskHandle_t freertos_rs_get_current_task() {
|
||||
return xTaskGetCurrentTaskHandle();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (configUSE_TIMERS == 1)
|
||||
|
||||
TimerHandle_t freertos_rs_timer_create(const char * const name, uint8_t name_len, const TickType_t period,
|
||||
uint8_t auto_reload, void * const timer_id, TimerCallbackFunction_t callback)
|
||||
{
|
||||
char c_name[configMAX_TASK_NAME_LEN] = {0};
|
||||
for (int i = 0; i < name_len; i++) {
|
||||
c_name[i] = name[i];
|
||||
|
||||
if (i == configMAX_TASK_NAME_LEN - 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UBaseType_t timer_auto_reload = pdFALSE;
|
||||
if (auto_reload == 1) {
|
||||
timer_auto_reload = pdTRUE;
|
||||
}
|
||||
|
||||
TimerHandle_t handle = xTimerCreate(c_name, period, timer_auto_reload, timer_id, callback);
|
||||
return handle;
|
||||
}
|
||||
|
||||
BaseType_t freertos_rs_timer_start(TimerHandle_t timer, TickType_t block_time) {
|
||||
if (xTimerStart(timer, block_time) != pdPASS) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BaseType_t freertos_rs_timer_stop(TimerHandle_t timer, TickType_t block_time) {
|
||||
if (xTimerStop(timer, block_time) != pdPASS) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BaseType_t freertos_rs_timer_delete(TimerHandle_t timer, TickType_t block_time) {
|
||||
if (xTimerDelete(timer, block_time) != pdPASS) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BaseType_t freertos_rs_timer_change_period(TimerHandle_t timer, TickType_t block_time, TickType_t new_period) {
|
||||
if (xTimerChangePeriod(timer, new_period, block_time) != pdPASS) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* freertos_rs_timer_get_id(TimerHandle_t timer) {
|
||||
return pvTimerGetTimerID(timer);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void freertos_rs_enter_critical() {
|
||||
taskENTER_CRITICAL();
|
||||
}
|
||||
|
||||
void freertos_rs_exit_critical() {
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
#![no_std]
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue