Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf_wifi: Add as a standlone library #1414

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions Kconfig.nrfxlib
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ rsource "gzll/Kconfig"
rsource "nrf_dm/Kconfig"
rsource "lc3/Kconfig"
rsource "nrf_fuel_gauge/Kconfig"
rsource "nrf_wifi/Kconfig"

endmenu
170 changes: 170 additions & 0 deletions nrf_wifi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
#
# 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_NRF70_RADIO_TEST
nrf-wifi
PUBLIC
${NRF_WIFI_DIR}/fw_if/umac_if/inc/radio_test
)

target_include_directories_ifndef(CONFIG_NRF70_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_NRF70_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_NRF70_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_ifdef(CONFIG_NRF_WIFI_LOW_POWER
nrf-wifi
PRIVATE
-DCONFIG_NRF_WIFI_LOW_POWER
)

target_compile_definitions_ifdef(CONFIG_NRF70_RADIO_TEST
nrf-wifi
PRIVATE
-DCONFIG_NRF700X_RADIO_TEST
)

target_compile_definitions(
nrf-wifi
PRIVATE
-DCONFIG_NRF700X_LOG_VERBOSE=${CONFIG_NRF700X_LOG_VERBOSE}
-DCONFIG_NRF700X_SCAN_ONLY=y
-DCONFIG_WIFI_NRF700X_LOG_LEVEL=${CONFIG_WIFI_NRF700X_SHIM_LOG_LEVEL}
-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
)
18 changes: 18 additions & 0 deletions nrf_wifi/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# 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.

config NRF70_RADIO_TEST
bool "Enable nRF70 radio test"
help
Enable the nRF70 radio test.

endmenu
2 changes: 2 additions & 0 deletions nrf_wifi/fw_if/umac_if/src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ enum nrf_wifi_status umac_cmd_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
#endif /* CONFIG_NRF700X_TCP_IP_CHECKSUM_OFFLOAD */
umac_cmd_data->discon_timeout = CONFIG_NRF_WIFI_AP_DEAD_DETECT_TIMEOUT;

umac_cmd_data->mgmt_buff_offload = 1;

nrf_wifi_osal_log_dbg(fmac_dev_ctx->fpriv->opriv, "RPU LPM type: %s",
umac_cmd_data->sys_params.sleep_enable == 2 ? "HW" :
umac_cmd_data->sys_params.sleep_enable == 1 ? "SW" : "DISABLED");
Expand Down
7 changes: 7 additions & 0 deletions nrf_wifi/hw_if/hal/inc/fw/pack_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
#include <zephyr/toolchain.h>
#elif __KERNEL__
#include <linux/compiler_attributes.h>
#else
#ifndef __packed
#define __packed __attribute__((packed))
#endif
#ifndef __aligned
#define __aligned(x) __attribute__((aligned(x)))
#endif
#endif

#define __NRF_WIFI_PKD __packed
Expand Down
4 changes: 4 additions & 0 deletions nrf_wifi/os_if/inc/osal_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/stdarg.h>
#else
#include <stddef.h>
#include <stdbool.h>
#include <stdarg.h>
#endif

/**
Expand Down
Loading