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: osal: Add support for standalone library #83356

Merged
merged 4 commits into from
Jan 9, 2025
Merged
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
2 changes: 1 addition & 1 deletion drivers/wifi/nrf_wifi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ zephyr_compile_definitions_ifdef(CONFIG_NRF70_ON_QSPI
-DNRF53_ERRATA_159_ENABLE_WORKAROUND=0
)

target_link_libraries(nrf_wifi PRIVATE nrf70-buslib)
zephyr_library_link_libraries(nrf70-buslib nrf-wifi-shim)

if (CONFIG_NRF_WIFI_PATCHES_BUILTIN)
zephyr_blobs_verify(MODULE nrf_wifi REQUIRED)
Expand Down
12 changes: 0 additions & 12 deletions drivers/wifi/nrf_wifi/Kconfig.nrfwifi
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,6 @@ config WIFI_NRF70_LOG_LEVEL
# Enable error by default
default 1

config NRF70_ON_QSPI
def_bool DT_HAS_NORDIC_NRF7002_QSPI_ENABLED || \
DT_HAS_NORDIC_NRF7001_QSPI_ENABLED || \
DT_HAS_NORDIC_NRF7000_QSPI_ENABLED
select NRFX_QSPI

config NRF70_ON_SPI
def_bool DT_HAS_NORDIC_NRF7002_SPI_ENABLED || \
DT_HAS_NORDIC_NRF7001_SPI_ENABLED || \
DT_HAS_NORDIC_NRF7000_SPI_ENABLED
select SPI

config NRF70_2_4G_ONLY
def_bool y if WIFI_NRF7001

Expand Down
177 changes: 4 additions & 173 deletions modules/nrf_wifi/os/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,184 +4,15 @@
if(NOT CONFIG_WIFI_NRF70)
return()
endif()
zephyr_interface_library_named(nrf-wifi-interface)
zephyr_library()

set(NRF_WIFI_DIR ${ZEPHYR_CURRENT_MODULE_DIR})

# Translate the configuration to the OS agnostic code
target_compile_definitions(
nrf-wifi-interface
INTERFACE
$<$<BOOL:${CONFIG_NRF_WIFI_LOW_POWER}>:NRF_WIFI_LOW_POWER>
$<$<BOOL:${CONFIG_NRF_WIFI_RPU_RECOVERY}>:NRF_WIFI_RPU_RECOVERY>
$<$<BOOL:${CONFIG_NRF_WIFI_AP_DEAD_DETECT_TIMEOUT}>:NRF_WIFI_AP_DEAD_DETECT_TIMEOUT=${CONFIG_NRF_WIFI_AP_DEAD_DETECT_TIMEOUT}>
$<$<BOOL:${CONFIG_NRF_WIFI_IFACE_MTU}>:NRF_WIFI_IFACE_MTU=${CONFIG_NRF_WIFI_IFACE_MTU}>
$<$<BOOL:${CONFIG_NRF70_STA_MODE}>:NRF70_STA_MODE>
$<$<BOOL:${CONFIG_NRF70_DATA_TX}>:NRF70_DATA_TX>
$<$<BOOL:${CONFIG_NRF70_RAW_DATA_TX}>:NRF70_RAW_DATA_TX>
$<$<BOOL:${CONFIG_NRF70_RAW_DATA_RX}>:NRF70_RAW_DATA_RX>
$<$<BOOL:${CONFIG_NRF70_PROMISC_DATA_RX}>:NRF70_PROMISC_DATA_RX>
$<$<BOOL:${CONFIG_NRF70_TX_DONE_WQ_ENABLED}>:NRF70_TX_DONE_WQ_ENABLED>
$<$<BOOL:${CONFIG_NRF70_RX_WQ_ENABLED}>:NRF70_RX_WQ_ENABLED>
$<$<BOOL:${CONFIG_NRF70_UTIL}>:NRF70_UTIL>
$<$<BOOL:${CONFIG_NRF70_RADIO_TEST}>:NRF70_RADIO_TEST>
$<$<BOOL:${CONFIG_NRF70_OFFLOADED_RAW_TX}>:NRF70_OFFLOADED_RAW_TX>
$<$<BOOL:${CONFIG_NRF70_TCP_IP_CHECKSUM_OFFLOAD}>:NRF70_TCP_IP_CHECKSUM_OFFLOAD>
$<$<BOOL:${CONFIG_NRF70_RPU_EXTEND_TWT_SP}>:NRF70_RPU_EXTEND_TWT_SP>
$<$<BOOL:${CONFIG_NRF70_SYSTEM_WITH_RAW_MODES}>:NRF70_SYSTEM_WITH_RAW_MODES>
$<$<BOOL:${CONFIG_NRF70_SCAN_ONLY}>:NRF70_SCAN_ONLY>
$<$<BOOL:${CONFIG_NRF70_SYSTEM_MODE}>:NRF70_SYSTEM_MODE>
$<$<BOOL:${CONFIG_NRF70_2_4G_ONLY}>:NRF70_2_4G_ONLY>
$<$<BOOL:${CONFIG_NRF70_LOG_VERBOSE}>:NRF70_LOG_VERBOSE>
$<$<BOOL:${CONFIG_NRF70_AP_MODE}>:NRF70_AP_MODE>
$<$<BOOL:${CONFIG_NRF_WIFI_MGMT_BUFF_OFFLOAD}>:NRF_WIFI_MGMT_BUFF_OFFLOAD>
$<$<BOOL:${CONFIG_NRF_WIFI_FEAT_KEEPALIVE}>:NRF_WIFI_FEAT_KEEPALIVE>
$<$<BOOL:${CONFIG_NRF_WIFI_FEAT_KEEPALIVE}>:NRF_WIFI_KEEPALIVE_PERIOD_S=${CONFIG_NRF_WIFI_KEEPALIVE_PERIOD_S}>
$<$<BOOL:${CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS}>:WIFI_MGMT_RAW_SCAN_RESULTS>
$<$<BOOL:${CONFIG_NRF_WIFI_COEX_DISABLE_PRIORITY_WINDOW_FOR_SCAN}>:NRF_WIFI_COEX_DISABLE_PRIORITY_WINDOW_FOR_SCAN>
NRF70_RX_NUM_BUFS=${CONFIG_NRF70_RX_NUM_BUFS}
NRF70_MAX_TX_TOKENS=${CONFIG_NRF70_MAX_TX_TOKENS}
NRF70_RX_MAX_DATA_SIZE=${CONFIG_NRF70_RX_MAX_DATA_SIZE}
NRF70_MAX_TX_PENDING_QLEN=${CONFIG_NRF70_MAX_TX_PENDING_QLEN}
NRF70_RPU_PS_IDLE_TIMEOUT_MS=${CONFIG_NRF70_RPU_PS_IDLE_TIMEOUT_MS}
NRF70_BAND_2G_LOWER_EDGE_BACKOFF_DSSS=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_DSSS}
NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HT}
NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HE}
NRF70_BAND_2G_UPPER_EDGE_BACKOFF_DSSS=${CONFIG_NRF70_BAND_2G_UPPER_EDGE_BACKOFF_DSSS}
NRF70_BAND_2G_UPPER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_2G_UPPER_EDGE_BACKOFF_HT}
NRF70_BAND_2G_UPPER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_2G_UPPER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_1_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_1_LOWER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_1_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_1_LOWER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_1_UPPER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_1_UPPER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_1_UPPER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_1_UPPER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_3_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_3_LOWER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_3_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_3_LOWER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_3_UPPER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_3_UPPER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_3_UPPER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_3_UPPER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_4_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_4_LOWER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_4_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_4_LOWER_EDGE_BACKOFF_HE}
NRF70_BAND_UNII_4_UPPER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_UNII_4_UPPER_EDGE_BACKOFF_HT}
NRF70_BAND_UNII_4_UPPER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_UNII_4_UPPER_EDGE_BACKOFF_HE}
NRF70_PCB_LOSS_2G=${CONFIG_NRF70_PCB_LOSS_2G}
NRF70_PCB_LOSS_5G_BAND1=${CONFIG_NRF70_PCB_LOSS_5G_BAND1}
NRF70_PCB_LOSS_5G_BAND2=${CONFIG_NRF70_PCB_LOSS_5G_BAND2}
NRF70_PCB_LOSS_5G_BAND3=${CONFIG_NRF70_PCB_LOSS_5G_BAND3}
NRF70_ANT_GAIN_2G=${CONFIG_NRF70_ANT_GAIN_2G}
NRF70_ANT_GAIN_5G_BAND1=${CONFIG_NRF70_ANT_GAIN_5G_BAND1}
NRF70_ANT_GAIN_5G_BAND2=${CONFIG_NRF70_ANT_GAIN_5G_BAND2}
NRF70_ANT_GAIN_5G_BAND3=${CONFIG_NRF70_ANT_GAIN_5G_BAND3}
NRF_WIFI_PS_INT_PS=${CONFIG_NRF_WIFI_PS_INT_PS}
NRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS=${CONFIG_NRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS}
NRF_WIFI_DISPLAY_SCAN_BSS_LIMIT=${CONFIG_NRF_WIFI_DISPLAY_SCAN_BSS_LIMIT}
)

target_include_directories(
nrf-wifi-interface
INTERFACE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../bus
${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
)

if(CONFIG_NRF70_RADIO_TEST)
target_include_directories(nrf-wifi-interface INTERFACE
${NRF_WIFI_DIR}/fw_if/umac_if/inc/radio_test
)
elseif(CONFIG_NRF70_OFFLOADED_RAW_TX)
target_include_directories(nrf-wifi-interface INTERFACE
${NRF_WIFI_DIR}/fw_if/umac_if/inc/offload_raw_tx
off_raw_tx/inc
)
else()
target_include_directories(nrf-wifi-interface INTERFACE
${NRF_WIFI_DIR}/fw_if/umac_if/inc/default
)
endif()

zephyr_library_sources(
${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
)

if(CONFIG_NRF70_RADIO_TEST)
zephyr_library_sources(
${NRF_WIFI_DIR}/fw_if/umac_if/src/radio_test/fmac_api.c
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c
)
elseif(CONFIG_NRF70_OFFLOADED_RAW_TX)
zephyr_library_sources(
${NRF_WIFI_DIR}/fw_if/umac_if/src/offload_raw_tx/fmac_api.c
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c
)
else()
zephyr_library_sources(
${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
)
endif()

zephyr_library_sources_ifdef(CONFIG_NRF70_DATA_TX
${NRF_WIFI_DIR}/fw_if/umac_if/src/tx.c
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_peer.c
)

zephyr_library_sources_ifdef(CONFIG_NRF70_STA_MODE
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_peer.c
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c
)

zephyr_library_sources_ifdef(CONFIG_NRF70_PROMISC_DATA_RX
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_promisc.c
)

zephyr_library_sources_ifdef(CONFIG_NRF70_AP_MODE
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_ap.c
)

# Without WPA supplicant we only support scan
zephyr_library_sources_ifdef(CONFIG_NRF70_STA_MODE
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_peer.c
${NRF_WIFI_DIR}/fw_if/umac_if/src/fmac_util.c
)
add_subdirectory(${ZEPHYR_NRF_WIFI_MODULE_DIR} nrf_wifi_osal)

zephyr_library_named(nrf-wifi-shim)
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR})
zephyr_library_sources(
shim.c
timer.c
work.c
)

target_link_libraries(zephyr_interface INTERFACE nrf-wifi-interface)
target_link_libraries(nrf_wifi PRIVATE nrf70-buslib)
zephyr_library_link_libraries(nrf-wifi-osal)
5 changes: 5 additions & 0 deletions tests/boards/nrf/nrf70/bustest/testcase.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
common:
build_only: true
tags:
- drivers
- wifi
tests:
nrf_wifi.bustest.nrf7002:
sysbuild: true
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ manifest:
revision: 71bcaa88c97977647d387217dab99f7d6f026815
path: modules/bsim_hw_models/nrf_hw_models
- name: nrf_wifi
revision: 0f53c9ebab526661131d5d7e73c7a6cb3b2d2e11
revision: 68b018473527fa90237b1abad7ee2568a665bb44
path: modules/lib/nrf_wifi
- name: open-amp
revision: 52bb1783521c62c019451cee9b05b8eda9d7425f
Expand Down
Loading