diff --git a/bsp/simulator/Kconfig b/bsp/simulator/Kconfig index 8dfdfdbabe..bb19d9575f 100644 --- a/bsp/simulator/Kconfig +++ b/bsp/simulator/Kconfig @@ -29,6 +29,11 @@ config RT_USING_DFS_WINSHAREDIR select RT_USING_POSIX_FS default n +config BSP_USING_SAL_WINSOCK + bool "Enable Windows socket (winsock) with SAL" + select RT_USING_SAL + default n + config BSP_USING_LVGL bool "Enable LVGL for LCD" select PKG_USING_LVGL diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h index b7b193d25a..8a4dbb68f3 100644 --- a/components/libc/compilers/common/sys/time.h +++ b/components/libc/compilers/common/sys/time.h @@ -43,14 +43,14 @@ struct timezone int tz_dsttime; /* type of dst correction */ }; -#if !defined(_TIMEVAL_DEFINED) +#ifndef _TIMEVAL_DEFINED #define _TIMEVAL_DEFINED struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* and microseconds */ }; -#endif /* !defined(_TIMEVAL_DEFINED) && !defined(_WIN32) */ +#endif /* _TIMEVAL_DEFINED */ #if defined(__ARMCC_VERSION) || defined(_WIN32) || (defined(__ICCARM__) && (__VER__ < 8010001)) struct timespec diff --git a/components/net/sal/Kconfig b/components/net/sal/Kconfig index 8542f02a2e..27a98d48d7 100644 --- a/components/net/sal/Kconfig +++ b/components/net/sal/Kconfig @@ -12,27 +12,28 @@ if RT_USING_SAL help The ability that check internet status is provided by RT-Thread. - if RT_USING_LWIP || AT_USING_SOCKET + menu "Docking with protocol stacks" - menu "protocol stack implement" + config SAL_USING_LWIP + bool "Docking with lwIP stack" + default y + depends on RT_USING_LWIP - config SAL_USING_LWIP - bool "Support lwIP stack" - default y - depends on RT_USING_LWIP + config SAL_USING_AT + bool "Docking with AT commands stack" + default y + depends on AT_USING_SOCKET - config SAL_USING_AT - bool "Support AT Commands stack" - default y - depends on AT_USING_SOCKET + config SAL_USING_WINSOCK + bool "Docking with Windows socket (winsock)" + default y + depends on BSP_USING_SAL_WINSOCK - config SAL_USING_TLS - bool "Support MbedTLS protocol" - default y - depends on PKG_USING_MBEDTLS - endmenu - - endif + config SAL_USING_TLS + bool "Docking with MbedTLS protocol" + default y + depends on PKG_USING_MBEDTLS + endmenu config SAL_USING_POSIX bool diff --git a/components/net/sal/SConscript b/components/net/sal/SConscript index 3903dce89a..25788e0bed 100644 --- a/components/net/sal/SConscript +++ b/components/net/sal/SConscript @@ -11,16 +11,19 @@ CPPPATH = [cwd + '/include'] CPPPATH += [cwd + '/include/socket'] if GetDepend('SAL_USING_LWIP'): - src += Glob('impl/af_inet_lwip.c') + src += Glob('docking/af_inet_lwip.c') if GetDepend('SAL_USING_AT'): - src += Glob('impl/af_inet_at.c') + src += Glob('docking/af_inet_at.c') if GetDepend('SAL_USING_LWIP') or GetDepend('SAL_USING_AT'): - CPPPATH += [cwd + '/impl'] + CPPPATH += [cwd + '/docking'] + +if GetDepend('SAL_USING_WINSOCK'): + src += Glob('docking/af_inet_winsock.c') if GetDepend('SAL_USING_TLS'): - src += Glob('impl/proto_mbedtls.c') + src += Glob('docking/proto_mbedtls.c') if GetDepend('SAL_USING_POSIX'): CPPPATH += [cwd + '/include/dfs_net'] diff --git a/components/net/sal/impl/af_inet.h b/components/net/sal/docking/af_inet.h similarity index 100% rename from components/net/sal/impl/af_inet.h rename to components/net/sal/docking/af_inet.h diff --git a/components/net/sal/impl/af_inet_at.c b/components/net/sal/docking/af_inet_at.c similarity index 100% rename from components/net/sal/impl/af_inet_at.c rename to components/net/sal/docking/af_inet_at.c diff --git a/components/net/sal/impl/af_inet_lwip.c b/components/net/sal/docking/af_inet_lwip.c similarity index 100% rename from components/net/sal/impl/af_inet_lwip.c rename to components/net/sal/docking/af_inet_lwip.c diff --git a/components/net/sal/docking/af_inet_winsock.c b/components/net/sal/docking/af_inet_winsock.c new file mode 100644 index 0000000000..f3f103d0ca --- /dev/null +++ b/components/net/sal/docking/af_inet_winsock.c @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2006-2022, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + */ + +#include + +/* Do NOT include sys/time.h in this file */ diff --git a/components/net/sal/impl/proto_mbedtls.c b/components/net/sal/docking/proto_mbedtls.c similarity index 100% rename from components/net/sal/impl/proto_mbedtls.c rename to components/net/sal/docking/proto_mbedtls.c