diff --git a/CMakeLists.txt b/CMakeLists.txt index 944033f196..f3f10704fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,3 +22,4 @@ add_subdirectory_ifdef(CONFIG_GZLL gzll) add_subdirectory_ifdef(CONFIG_NRF_DM nrf_dm) add_subdirectory_ifdef(CONFIG_NRF_FUEL_GAUGE nrf_fuel_gauge) add_subdirectory_ifdef(CONFIG_SW_CODEC_LC3_T2_SOFTWARE lc3) +add_subdirectory_ifdef(CONFIG_NRF_WIFI nrf_wifi) diff --git a/Kconfig.nrfxlib b/Kconfig.nrfxlib index e864b06531..7daed1a7d1 100644 --- a/Kconfig.nrfxlib +++ b/Kconfig.nrfxlib @@ -18,5 +18,6 @@ rsource "gzll/Kconfig" rsource "nrf_dm/Kconfig" rsource "lc3/Kconfig" rsource "nrf_fuel_gauge/Kconfig" +rsource "nrf_wifi/Kconfig" endmenu diff --git a/nrf_wifi/CMakeLists.txt b/nrf_wifi/CMakeLists.txt new file mode 100644 index 0000000000..7cbb2a0df3 --- /dev/null +++ b/nrf_wifi/CMakeLists.txt @@ -0,0 +1,155 @@ +# +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# Enable debug info by default +# Set the CPU architecture to armv8-m.main (Cortex-M33), default is armv4t +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -mcpu=cortex-m33 -mthumb") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -mcpu=cortex-m33 -mthumb") + +add_library(nrf-wifi STATIC) + +set(NRF_WIFI_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +target_include_directories( + nrf-wifi + PUBLIC + ${NRF_WIFI_DIR}/utils/inc + ${NRF_WIFI_DIR}/os_if/inc + ${NRF_WIFI_DIR}/bus_if/bus/qspi/inc + ${NRF_WIFI_DIR}/bus_if/bal/inc + ${NRF_WIFI_DIR}/fw_if/umac_if/inc + ${NRF_WIFI_DIR}/fw_load/mips/fw/inc + ${NRF_WIFI_DIR}/hw_if/hal/inc + ${NRF_WIFI_DIR}/hw_if/hal/inc/fw + ${NRF_WIFI_DIR}/fw_if/umac_if/inc/fw +) + +target_include_directories_ifdef(CONFIG_NRF700X_RADIO_TEST + nrf-wifi + PUBLIC + ${NRF_WIFI_DIR}/fw_if/umac_if/inc/radio_test +) + +target_include_directories_ifndef(CONFIG_NRF700X_RADIO_TEST + nrf-wifi + PUBLIC + ${NRF_WIFI_DIR}/fw_if/umac_if/inc/default +) + +target_sources( + nrf-wifi + PRIVATE + ${NRF_WIFI_DIR}/os_if/src/osal.c + ${NRF_WIFI_DIR}/utils/src/list.c + ${NRF_WIFI_DIR}/utils/src/queue.c + ${NRF_WIFI_DIR}/utils/src/util.c + ${NRF_WIFI_DIR}/hw_if/hal/src/hal_api.c + ${NRF_WIFI_DIR}/hw_if/hal/src/hal_fw_patch_loader.c + ${NRF_WIFI_DIR}/hw_if/hal/src/hal_interrupt.c + ${NRF_WIFI_DIR}/hw_if/hal/src/hal_mem.c + ${NRF_WIFI_DIR}/hw_if/hal/src/hal_reg.c + ${NRF_WIFI_DIR}/hw_if/hal/src/hpqm.c + ${NRF_WIFI_DIR}/hw_if/hal/src/pal.c + ${NRF_WIFI_DIR}/bus_if/bal/src/bal.c + ${NRF_WIFI_DIR}/bus_if/bus/qspi/src/qspi.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/cmd.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/event.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_api_common.c +) + +target_sources_ifndef(CONFIG_NRF700X_RADIO_TEST + nrf-wifi + PRIVATE + ${NRF_WIFI_DIR}/fw_if/umac_if/src/rx.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_vif.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/default/fmac_api.c +) + +target_sources_ifdef(CONFIG_NRF700X_RADIO_TEST + nrf-wifi + PRIVATE + ${NRF_WIFI_DIR}/fw_if/umac_if/src/radio_test/fmac_api.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c +) + +target_sources_ifdef(CONFIG_NRF700X_DATA_TX + nrf-wifi + PRIVATE + ${NRF_WIFI_DIR}/fw_if/umac_if/src/tx.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_peer.c +) + +target_sources_ifdef(CONFIG_NRF700X_STA_MODE + nrf-wifi + PRIVATE + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_peer.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c +) + +target_sources_ifdef(CONFIG_NRF700X_AP_MODE + nrf-wifi + PRIVATE + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_ap.c +) + +# Without WPA supplicant we only support scan +target_sources_ifdef(CONFIG_NRF700X_STA_MODE + nrf-wifi + PRIVATE + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_peer.c + ${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c +) + +target_compile_definitions( + nrf-wifi + PRIVATE + -DCONFIG_NRF700X_MAX_TX_TOKENS=10 + -DCONFIG_NRF700X_MAX_TX_AGGREGATION=12 + -DCONFIG_NRF700X_RX_NUM_BUFS=63 + -DCONFIG_NRF700X_RX_MAX_DATA_SIZE=1600 + -DCONFIG_WIFI_MGMT_RAW_SCAN_RESULTS + -DCONFIG_NRF700X_ANT_GAIN_2G=0 + -DCONFIG_NRF700X_ANT_GAIN_5G_BAND1=0 + -DCONFIG_NRF700X_ANT_GAIN_5G_BAND2=0 + -DCONFIG_NRF700X_ANT_GAIN_5G_BAND3=0 + -DCONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_DSSS=0 + -DCONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_DSSS=0 + -DCONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HT=0 + -DCONFIG_NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HE=0 + -DCONFIG_NRF700X_REG_DOMAIN="00" + -DCONFIG_NRF700X_TX_MAX_DATA_SIZE=1600 + -DCONFIG_NRF_WIFI_IFACE_MTU=1500 + -DCONFIG_NRF700X_MAX_TX_PENDING_QLEN=48 + -DCONFIG_NRF700X_RPU_PS_IDLE_TIMEOUT_MS=10 + -DCONFIG_NRF700X_PCB_LOSS_2G=0 + -DCONFIG_NRF700X_PCB_LOSS_5G_BAND1=0 + -DCONFIG_NRF700X_PCB_LOSS_5G_BAND2=0 + -DCONFIG_NRF700X_PCB_LOSS_5G_BAND3=0 + -DCONFIG_NRF_WIFI_AP_DEAD_DETECT_TIMEOUT=20 +) diff --git a/nrf_wifi/Kconfig b/nrf_wifi/Kconfig new file mode 100644 index 0000000000..95fe115863 --- /dev/null +++ b/nrf_wifi/Kconfig @@ -0,0 +1,12 @@ +# +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: BSD-3-Clause +# +menu "Nordic nRF70 Wi-Fi configuration" + +config NRF_WIFI + bool "Enable nRF70 OS agnostic library" + help + Enable the nRF70 OS agnostic library. +endmenu diff --git a/nrf_wifi/hw_if/hal/inc/fw/pack_def.h b/nrf_wifi/hw_if/hal/inc/fw/pack_def.h index ae5a43937d..f09457971b 100644 --- a/nrf_wifi/hw_if/hal/inc/fw/pack_def.h +++ b/nrf_wifi/hw_if/hal/inc/fw/pack_def.h @@ -15,6 +15,13 @@ #include #elif __KERNEL__ #include +#else +#ifndef __packed +#define __packed __attribute__((packed)) +#endif +#ifndef __aligned +#define __aligned(x) __attribute__((aligned(x))) +#endif #endif #define __NRF_WIFI_PKD __packed diff --git a/nrf_wifi/os_if/inc/osal_structs.h b/nrf_wifi/os_if/inc/osal_structs.h index 26ff53ccc7..748ea6010a 100644 --- a/nrf_wifi/os_if/inc/osal_structs.h +++ b/nrf_wifi/os_if/inc/osal_structs.h @@ -21,6 +21,10 @@ #include #include #include +#else +#include +#include +#include #endif /**