diff --git a/ext/hal/ti/simplelink/Kbuild b/ext/hal/ti/simplelink/Kbuild index fdb5fa0fdd..f5a107c8c9 100644 --- a/ext/hal/ti/simplelink/Kbuild +++ b/ext/hal/ti/simplelink/Kbuild @@ -1,5 +1,37 @@ ccflags-$(CONFIG_HAS_CC3220SDK) += -D$(COMPILER) -# Need to build prcm and utils for PRCMCC3220MCUInit, which is not in ROM +# Need to build prcm, utils and pin, which are not in ROM obj-$(CONFIG_HAS_CC3220SDK) += source/ti/devices/cc32xx/driverlib/utils.o obj-$(CONFIG_HAS_CC3220SDK) += source/ti/devices/cc32xx/driverlib/prcm.o obj-$(CONFIG_HAS_CC3220SDK) += source/ti/devices/cc32xx/driverlib/pin.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/SPI.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/spi/SPICC32XXDMA.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/dma/UDMACC32XX.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/power/PowerCC32XX.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/utils/List.o +CFLAGS_driver.o += -D__LINUX_ERRNO_EXTENSIONS__ +# driver.c warns on strict-aliasing +CFLAGS_driver.o += -Wno-strict-aliasing +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/driver.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/device.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/flowcont.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/fs.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/netapp.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/netcfg.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/netutil.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/nonos.o +# sl_socket warns on missing braces: +CFLAGS_sl_socket.o += -Wno-missing-braces +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/sl_socket.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/spawn.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/wlan.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/porting/CC3220SF_LAUNCHXL.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/porting/cc_pal.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/eventreg.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/drivers/net/wifi/source/socket.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/devices/cc32xx/driverlib/timer.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += source/ti/devices/cc32xx/driverlib/udma.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/dpl.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/MutexP_zephyr.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/SemaphoreP_zephyr.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/ClockP_zephyr.o +obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/HwiP_zephyr.o diff --git a/ext/hal/ti/simplelink/Kconfig b/ext/hal/ti/simplelink/Kconfig index a7d79436e3..362b9aa140 100644 --- a/ext/hal/ti/simplelink/Kconfig +++ b/ext/hal/ti/simplelink/Kconfig @@ -3,9 +3,15 @@ config HAS_CC3220SDK bool -menuconfig CC3220SDK - bool "TI CC3220 SDK support" +# Notes: +# SimpleLink drivers require types (stdint.h) from NEWLIB_LIBC +# Selecting ERRNO lets host driver use Zephyr's __errno +config SIMPLELINK_HOST_DRIVER + bool "Build the SimpleLink WiFi Host Driver" default n depends on HAS_CC3220SDK + depends on MULTITHREADING + depends on NEWLIB_LIBC + select ERRNO help - Build required peripheral driverlib files from the CC3220 SDK + Build the SimpleLink host driver diff --git a/ext/hal/ti/simplelink/Makefile b/ext/hal/ti/simplelink/Makefile index 6dc111fe4b..a3c94eb736 100644 --- a/ext/hal/ti/simplelink/Makefile +++ b/ext/hal/ti/simplelink/Makefile @@ -4,3 +4,9 @@ ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/source/ti/devices/cc32xx/inc ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/source/ti/devices/cc32xx/driverlib KBUILD_CFLAGS += -DUSE_CC3220_ROM_DRV_API endif # CONFIG_HAS_CC3220SDK +ifdef CONFIG_SIMPLELINK_HOST_DRIVER +ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/source +ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/kernel/zephyr/dpl +KBUILD_CFLAGS += -DSL_SUPPORT_IPV6 +KBUILD_CFLAGS += -DSL_PLATFORM_MULTI_THREADED +endif # CONFIG_SIMPLELINK_HOST_DRIVER diff --git a/ext/hal/ti/simplelink/README b/ext/hal/ti/simplelink/README index bc44e3dc05..2f8e2cf6a7 100644 --- a/ext/hal/ti/simplelink/README +++ b/ext/hal/ti/simplelink/README @@ -35,3 +35,7 @@ compiled in the Kbuild file: - driverlib/pin.c - driverlib/utils.c - driverlib/prcm.c + +Setting CONFIG_SIMPLELINK_HOST_DRIVER=y builds the SimpleLink Host +Driver, which communicates over dedicated SPI to the +network coprocessor. diff --git a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h index 35b99bfd59..a7222ec566 100644 --- a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h +++ b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h @@ -174,7 +174,9 @@ typedef signed int _SlFd_t; (Once errno has been read, the driver assumes it can be allocated to another thread). */ +/* Zephyr Port: use Zephyr's errno mechanism: #define SL_INC_INTERNAL_ERRNO +*/ /*! \brief Defines whether to include extended API in SimpleLink driver @@ -686,7 +688,19 @@ typedef signed int _SlFd_t; \warning */ #ifndef SL_INC_INTERNAL_ERRNO -#define slcb_SetErrno +/* + * Zephyr Port: use Zephyr SDK's errno.h definitions, and supply those missing + * to allow the SimpleLink driver.c to compile + * Also, supply the external errno setter function. + */ +#include +#define ERROR EIO +#define INEXE EALREADY +#define ENSOCK ENFILE + +#include +#define slcb_SetErrno dpl_set_errno + #endif /*!