drivers: nrf_wifi: Restructure to carve out a new nrf70 bus lib
The nrf wifi drivers include code related to qspi/spi bus. This work moves bus related files to a new nrf70 bus library which is now independent of the core driver and facilitlates building applications directly using the bus APIs, agnostic to enabling wifi configs. Signed-off-by: Bansidhar P.M <bansidhar.mangalwedhekar@nordicsemi.no>
This commit is contained in:
parent
9764bae573
commit
0aeb81d6b5
23 changed files with 298 additions and 635 deletions
|
@ -11,7 +11,6 @@ set(FW_BINS_BASE ${ZEPHYR_NRF_WIFI_MODULE_DIR}/zephyr/blobs/wifi_fw_bins)
|
|||
|
||||
zephyr_include_directories(
|
||||
inc
|
||||
src/qspi/inc
|
||||
# for net_sprint_ll_addr
|
||||
${ZEPHYR_BASE}/subsys/net/ip
|
||||
)
|
||||
|
@ -24,12 +23,6 @@ zephyr_library_sources_ifdef(CONFIG_NRF70_SR_COEX
|
|||
src/coex.c
|
||||
)
|
||||
|
||||
zephyr_library_sources(
|
||||
src/qspi/src/device.c
|
||||
src/qspi/src/rpu_hw_if.c
|
||||
src/qspi/src/ficr_prog.c
|
||||
)
|
||||
|
||||
zephyr_library_sources_ifndef(CONFIG_NRF70_OFFLOADED_RAW_TX
|
||||
src/fmac_main.c
|
||||
)
|
||||
|
@ -65,14 +58,6 @@ zephyr_library_sources_ifdef(CONFIG_NRF70_STA_MODE
|
|||
zephyr_library_sources_ifdef(CONFIG_NRF70_STA_MODE
|
||||
src/wpa_supp_if.c)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_NRF70_ON_QSPI
|
||||
src/qspi/src/qspi_if.c
|
||||
)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_NRF70_ON_SPI
|
||||
src/qspi/src/spi_if.c
|
||||
)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_NRF70_UTIL
|
||||
src/wifi_util.c
|
||||
)
|
||||
|
@ -88,6 +73,8 @@ zephyr_compile_definitions_ifdef(CONFIG_NRF70_ON_QSPI
|
|||
-DNRF53_ERRATA_159_ENABLE_WORKAROUND=0
|
||||
)
|
||||
|
||||
target_link_libraries(nrf_wifi PRIVATE nrf70-buslib)
|
||||
|
||||
if (CONFIG_NRF_WIFI_BUILD_ONLY_MODE)
|
||||
message(WARNING "
|
||||
------------------------------------------------------------------------
|
||||
|
|
|
@ -11,6 +11,7 @@ menuconfig WIFI_NRF70
|
|||
select NET_L2_ETHERNET_MGMT if NETWORKING && NET_L2_ETHERNET
|
||||
select WIFI_USE_NATIVE_NETWORKING if NETWORKING
|
||||
select EXPERIMENTAL if !SOC_SERIES_NRF53X && !SOC_SERIES_NRF91X
|
||||
select NRF70_BUSLIB
|
||||
default y
|
||||
depends on \
|
||||
DT_HAS_NORDIC_NRF7002_SPI_ENABLED || DT_HAS_NORDIC_NRF7002_QSPI_ENABLED || \
|
||||
|
@ -33,16 +34,9 @@ config WIFI_NRF7000
|
|||
bool
|
||||
default y if DT_HAS_NORDIC_NRF7000_SPI_ENABLED || DT_HAS_NORDIC_NRF7000_QSPI_ENABLED
|
||||
|
||||
|
||||
module = WIFI_NRF70_BUS
|
||||
module-dep = LOG
|
||||
module-str = Log level for Wi-Fi nRF70 bus layers
|
||||
module-help = Sets log level for Wi-Fi nRF70 bus layers
|
||||
source "subsys/net/Kconfig.template.log_config.net"
|
||||
|
||||
config WIFI_NRF70_BUS_LOG_LEVEL
|
||||
# Enable error by default
|
||||
default 1
|
||||
config NRF70_QSPI_LOW_POWER
|
||||
bool "low power mode in QSPI"
|
||||
default y if NRF_WIFI_LOW_POWER
|
||||
|
||||
choice NRF70_OPER_MODES
|
||||
bool "nRF70 operating modes"
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Header containing address/offets and functions for writing
|
||||
* the FICR fields of the OTP memory on nRF7002 device
|
||||
*/
|
||||
|
||||
#ifndef __OTP_PROG_H_
|
||||
#define __OTP_PROG_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int write_otp_memory(unsigned int otp_addr, unsigned int *write_val);
|
||||
int read_otp_memory(unsigned int otp_addr, unsigned int *read_val, int len);
|
||||
unsigned int check_protection(unsigned int *buff, unsigned int off1, unsigned int off2,
|
||||
unsigned int off3, unsigned int off4);
|
||||
|
||||
#endif /* __OTP_PROG_H_ */
|
|
@ -1,379 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* @file
|
||||
* @brief NRF Wi-Fi radio FICR programming functions
|
||||
*/
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include "rpu_if.h"
|
||||
#include "rpu_hw_if.h"
|
||||
#include "ficr_prog.h"
|
||||
|
||||
|
||||
LOG_MODULE_DECLARE(otp_prog, CONFIG_WIFI_NRF70_BUS_LOG_LEVEL);
|
||||
|
||||
static void write_word(unsigned int addr, unsigned int data)
|
||||
{
|
||||
rpu_write(addr, &data, 4);
|
||||
}
|
||||
|
||||
static void read_word(unsigned int addr, unsigned int *data)
|
||||
{
|
||||
rpu_read(addr, data, 4);
|
||||
}
|
||||
|
||||
unsigned int check_protection(unsigned int *buff, unsigned int off1, unsigned int off2,
|
||||
unsigned int off3, unsigned int off4)
|
||||
{
|
||||
if ((buff[off1] == OTP_PROGRAMMED) &&
|
||||
(buff[off2] == OTP_PROGRAMMED) &&
|
||||
(buff[off3] == OTP_PROGRAMMED) &&
|
||||
(buff[off4] == OTP_PROGRAMMED))
|
||||
return OTP_PROGRAMMED;
|
||||
else if ((buff[off1] == OTP_FRESH_FROM_FAB) &&
|
||||
(buff[off2] == OTP_FRESH_FROM_FAB) &&
|
||||
(buff[off3] == OTP_FRESH_FROM_FAB) &&
|
||||
(buff[off4] == OTP_FRESH_FROM_FAB))
|
||||
return OTP_FRESH_FROM_FAB;
|
||||
else if ((buff[off1] == OTP_ENABLE_PATTERN) &&
|
||||
(buff[off2] == OTP_ENABLE_PATTERN) &&
|
||||
(buff[off3] == OTP_ENABLE_PATTERN) &&
|
||||
(buff[off4] == OTP_ENABLE_PATTERN))
|
||||
return OTP_ENABLE_PATTERN;
|
||||
else
|
||||
return OTP_INVALID;
|
||||
}
|
||||
|
||||
|
||||
static void set_otp_timing_reg_40mhz(void)
|
||||
{
|
||||
write_word(OTP_TIMING_REG1_ADDR, OTP_TIMING_REG1_VAL);
|
||||
write_word(OTP_TIMING_REG2_ADDR, OTP_TIMING_REG2_VAL);
|
||||
}
|
||||
|
||||
static int poll_otp_ready(void)
|
||||
{
|
||||
int otp_mem_status = 0;
|
||||
int poll = 0;
|
||||
|
||||
while (poll != 100) {
|
||||
read_word(OTP_POLL_ADDR, &otp_mem_status);
|
||||
|
||||
if ((otp_mem_status & OTP_READY) == OTP_READY) {
|
||||
return 0;
|
||||
}
|
||||
poll++;
|
||||
}
|
||||
LOG_ERR("OTP is not ready");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
static int req_otp_standby_mode(void)
|
||||
{
|
||||
write_word(OTP_RWSBMODE_ADDR, 0x0);
|
||||
return poll_otp_ready();
|
||||
}
|
||||
|
||||
|
||||
static int otp_wr_voltage_2V5(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = req_otp_standby_mode();
|
||||
|
||||
if (err) {
|
||||
LOG_ERR("Failed Setting OTP voltage IOVDD to 2.5V");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
write_word(OTP_VOLTCTRL_ADDR, OTP_VOLTCTRL_2V5);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int poll_otp_read_valid(void)
|
||||
{
|
||||
int otp_mem_status = 0;
|
||||
int poll = 0;
|
||||
|
||||
while (poll < 100) {
|
||||
read_word(OTP_POLL_ADDR, &otp_mem_status);
|
||||
|
||||
if ((otp_mem_status & OTP_READ_VALID) == OTP_READ_VALID) {
|
||||
return 0;
|
||||
}
|
||||
poll++;
|
||||
}
|
||||
LOG_ERR("%s: OTP read failed", __func__);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
static int poll_otp_wrdone(void)
|
||||
{
|
||||
int otp_mem_status = 0;
|
||||
int poll = 0;
|
||||
|
||||
while (poll < 100) {
|
||||
read_word(OTP_POLL_ADDR, &otp_mem_status);
|
||||
|
||||
if ((otp_mem_status & OTP_WR_DONE) == OTP_WR_DONE) {
|
||||
return 0;
|
||||
}
|
||||
poll++;
|
||||
}
|
||||
LOG_ERR("%s: OTP write done failed", __func__);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
static int req_otp_read_mode(void)
|
||||
{
|
||||
write_word(OTP_RWSBMODE_ADDR, OTP_READ_MODE);
|
||||
return poll_otp_ready();
|
||||
}
|
||||
|
||||
|
||||
static int req_otp_byte_write_mode(void)
|
||||
{
|
||||
write_word(OTP_RWSBMODE_ADDR, OTP_BYTE_WRITE_MODE);
|
||||
return poll_otp_ready();
|
||||
}
|
||||
|
||||
static unsigned int read_otp_location(unsigned int offset, unsigned int *read_val)
|
||||
{
|
||||
int err;
|
||||
|
||||
write_word(OTP_RDENABLE_ADDR, offset);
|
||||
err = poll_otp_read_valid();
|
||||
if (err) {
|
||||
LOG_ERR("OTP read failed");
|
||||
return err;
|
||||
}
|
||||
read_word(OTP_READREG_ADDR, read_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_otp_location(unsigned int otp_location_offset, unsigned int otp_data)
|
||||
{
|
||||
write_word(OTP_WRENABLE_ADDR, otp_location_offset);
|
||||
write_word(OTP_WRITEREG_ADDR, otp_data);
|
||||
|
||||
return poll_otp_wrdone();
|
||||
}
|
||||
|
||||
|
||||
static int otp_rd_voltage_1V8(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = req_otp_standby_mode();
|
||||
if (err) {
|
||||
LOG_ERR("error in %s", __func__);
|
||||
return err;
|
||||
}
|
||||
write_word(OTP_VOLTCTRL_ADDR, OTP_VOLTCTRL_1V8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_mac_addr(unsigned int index, unsigned int *write_val)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
ret = write_otp_location(MAC0_ADDR + 2 * index + i, write_val[i]);
|
||||
if (ret == -ENOEXEC) {
|
||||
LOG_ERR("FICR: Failed to update MAC ADDR%d", index);
|
||||
break;
|
||||
}
|
||||
LOG_INF("mac addr %d : Reg%d (0x%x) = 0x%04x",
|
||||
index, (i+1), (MAC0_ADDR + i) << 2, write_val[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int write_otp_memory(unsigned int otp_addr, unsigned int *write_val)
|
||||
{
|
||||
int err = 0;
|
||||
int mask_val;
|
||||
int ret = 0;
|
||||
int retrim_loc = 0;
|
||||
|
||||
err = poll_otp_ready();
|
||||
if (err) {
|
||||
LOG_ERR("err in otp ready poll");
|
||||
return err;
|
||||
}
|
||||
|
||||
set_otp_timing_reg_40mhz();
|
||||
|
||||
err = otp_wr_voltage_2V5();
|
||||
if (err) {
|
||||
LOG_ERR("error in write_voltage 2V5");
|
||||
goto _exit_otp_write;
|
||||
}
|
||||
|
||||
err = req_otp_byte_write_mode();
|
||||
if (err) {
|
||||
LOG_ERR("error in OTP byte write mode");
|
||||
goto _exit_otp_write;
|
||||
}
|
||||
|
||||
switch (otp_addr) {
|
||||
case REGION_PROTECT:
|
||||
write_otp_location(REGION_PROTECT, write_val[0]);
|
||||
write_otp_location(REGION_PROTECT+1, write_val[0]);
|
||||
write_otp_location(REGION_PROTECT+2, write_val[0]);
|
||||
write_otp_location(REGION_PROTECT+3, write_val[0]);
|
||||
|
||||
LOG_INF("Written REGION_PROTECT0 (0x%x) : 0x%04x",
|
||||
(REGION_PROTECT << 2), write_val[0]);
|
||||
LOG_INF("Written REGION_PROTECT1 (0x%x) : 0x%04x",
|
||||
(REGION_PROTECT+1) << 2, write_val[0]);
|
||||
LOG_INF("Written REGION_PROTECT2 (0x%x) : 0x%04x",
|
||||
(REGION_PROTECT+2) << 2, write_val[0]);
|
||||
LOG_INF("Written REGION_PROTECT3 (0x%x) : 0x%04x",
|
||||
(REGION_PROTECT+3) << 2, write_val[0]);
|
||||
break;
|
||||
case QSPI_KEY:
|
||||
mask_val = QSPI_KEY_FLAG_MASK;
|
||||
for (int i = 0; i < QSPI_KEY_LENGTH_BYTES / 4; i++) {
|
||||
ret = write_otp_location(QSPI_KEY + i, write_val[i]);
|
||||
if (ret == -ENOEXEC) {
|
||||
LOG_ERR("FICR: Failed to write QSPI key offset-%d", QSPI_KEY + i);
|
||||
goto _exit_otp_write;
|
||||
}
|
||||
LOG_INF("Written QSPI_KEY0 (0x%x) : 0x%04x",
|
||||
(QSPI_KEY + i) << 2, write_val[i]);
|
||||
}
|
||||
write_otp_location(REGION_DEFAULTS, mask_val);
|
||||
LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x",
|
||||
(REGION_DEFAULTS) << 2, mask_val);
|
||||
break;
|
||||
case MAC0_ADDR:
|
||||
mask_val = MAC0_ADDR_FLAG_MASK;
|
||||
ret = update_mac_addr(0, write_val);
|
||||
if (ret == -ENOEXEC) {
|
||||
goto _exit_otp_write;
|
||||
}
|
||||
|
||||
write_otp_location(REGION_DEFAULTS, mask_val);
|
||||
LOG_INF("Written MAC address 0");
|
||||
LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x",
|
||||
(REGION_DEFAULTS) << 2, mask_val);
|
||||
break;
|
||||
case MAC1_ADDR:
|
||||
mask_val = MAC1_ADDR_FLAG_MASK;
|
||||
ret = update_mac_addr(1, write_val);
|
||||
if (ret == -ENOEXEC) {
|
||||
goto _exit_otp_write;
|
||||
}
|
||||
write_otp_location(REGION_DEFAULTS, mask_val);
|
||||
LOG_INF("Written MAC address 1");
|
||||
LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x",
|
||||
(REGION_DEFAULTS) << 2, mask_val);
|
||||
break;
|
||||
case CALIB_XO:
|
||||
mask_val = CALIB_XO_FLAG_MASK;
|
||||
ret = write_otp_location(CALIB_XO, write_val[0]);
|
||||
|
||||
if (ret == -ENOEXEC) {
|
||||
LOG_ERR("XO_Update Exception");
|
||||
goto _exit_otp_write;
|
||||
} else {
|
||||
write_otp_location(REGION_DEFAULTS, mask_val);
|
||||
|
||||
LOG_INF("Written CALIB_XO (0x%x) to 0x%04x",
|
||||
CALIB_XO << 2, write_val[0]);
|
||||
LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x",
|
||||
(REGION_DEFAULTS) << 2, mask_val);
|
||||
}
|
||||
break;
|
||||
case PRODRETEST_PROGVERSION:
|
||||
ret = write_otp_location(PRODRETEST_PROGVERSION, *write_val);
|
||||
|
||||
if (ret == -ENOEXEC) {
|
||||
LOG_ERR("PRODRETEST.PROGVERSION_Update Exception");
|
||||
goto _exit_otp_write;
|
||||
} else {
|
||||
LOG_INF("Written PRODRETEST.PROGVERSION 0x%04x", *write_val);
|
||||
}
|
||||
break;
|
||||
case PRODRETEST_TRIM0:
|
||||
case PRODRETEST_TRIM1:
|
||||
case PRODRETEST_TRIM2:
|
||||
case PRODRETEST_TRIM3:
|
||||
case PRODRETEST_TRIM4:
|
||||
case PRODRETEST_TRIM5:
|
||||
case PRODRETEST_TRIM6:
|
||||
case PRODRETEST_TRIM7:
|
||||
case PRODRETEST_TRIM8:
|
||||
case PRODRETEST_TRIM9:
|
||||
case PRODRETEST_TRIM10:
|
||||
case PRODRETEST_TRIM11:
|
||||
case PRODRETEST_TRIM12:
|
||||
case PRODRETEST_TRIM13:
|
||||
case PRODRETEST_TRIM14:
|
||||
retrim_loc = otp_addr - PRODRETEST_TRIM0;
|
||||
ret = write_otp_location(otp_addr, *write_val);
|
||||
|
||||
if (ret == -ENOEXEC) {
|
||||
LOG_ERR("PRODRETEST.TRIM_Update Exception");
|
||||
goto _exit_otp_write;
|
||||
} else {
|
||||
LOG_INF("Written PRODRETEST.TRIM%d 0x%04x",
|
||||
retrim_loc, *write_val);
|
||||
}
|
||||
break;
|
||||
case REGION_DEFAULTS:
|
||||
write_otp_location(REGION_DEFAULTS, write_val[0]);
|
||||
|
||||
LOG_INF("Written REGION_DEFAULTS (0x%x) to 0x%04x",
|
||||
REGION_DEFAULTS << 2, write_val[0]);
|
||||
break;
|
||||
default:
|
||||
LOG_ERR("unknown field received: %d", otp_addr);
|
||||
|
||||
}
|
||||
return ret;
|
||||
|
||||
_exit_otp_write:
|
||||
err = req_otp_standby_mode();
|
||||
err |= otp_rd_voltage_1V8();
|
||||
return err;
|
||||
}
|
||||
|
||||
int read_otp_memory(unsigned int otp_addr, unsigned int *read_val, int len)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = poll_otp_ready();
|
||||
if (err) {
|
||||
LOG_ERR("err in otp ready poll");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
set_otp_timing_reg_40mhz();
|
||||
|
||||
err = otp_rd_voltage_1V8();
|
||||
if (err) {
|
||||
LOG_ERR("error in read_voltage 1V8");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
err = req_otp_read_mode();
|
||||
if (err) {
|
||||
LOG_ERR("error in req_otp_read_mode()");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
read_otp_location(otp_addr + i, &read_val[i]);
|
||||
}
|
||||
|
||||
return req_otp_standby_mode();
|
||||
}
|
|
@ -1,184 +1,6 @@
|
|||
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
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>
|
||||
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_REG_DOMAIN=${CONFIG_NRF70_REG_DOMAIN}
|
||||
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}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
nrf-wifi-interface
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${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
|
||||
)
|
||||
|
||||
zephyr_library_sources(
|
||||
shim.c
|
||||
timer.c
|
||||
work.c
|
||||
)
|
||||
|
||||
target_link_libraries(zephyr_interface INTERFACE nrf-wifi-interface)
|
||||
add_subdirectory_ifdef(CONFIG_WIFI_NRF70 os)
|
||||
add_subdirectory_ifdef(CONFIG_NRF70_BUSLIB bus)
|
||||
|
|
|
@ -3,3 +3,5 @@
|
|||
|
||||
config ZEPHYR_NRF_WIFI_MODULE
|
||||
bool
|
||||
|
||||
source "modules/nrf_wifi/bus/Kconfig"
|
||||
|
|
27
modules/nrf_wifi/bus/CMakeLists.txt
Normal file
27
modules/nrf_wifi/bus/CMakeLists.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# Check if ZEPHYR_BASE is set
|
||||
if(NOT DEFINED ENV{ZEPHYR_BASE})
|
||||
message(FATAL_ERROR "ZEPHYR_BASE environment variable is not set. Please set it to the Zephyr base directory.")
|
||||
endif()
|
||||
|
||||
if (CONFIG_NRF70_BUSLIB)
|
||||
zephyr_library_named(nrf70-buslib)
|
||||
zephyr_library_include_directories(
|
||||
inc
|
||||
)
|
||||
zephyr_library_sources(
|
||||
rpu_hw_if.c
|
||||
device.c
|
||||
)
|
||||
zephyr_library_sources_ifdef(CONFIG_NRF70_ON_QSPI
|
||||
qspi_if.c
|
||||
)
|
||||
zephyr_library_sources_ifdef(CONFIG_NRF70_ON_SPI
|
||||
spi_if.c
|
||||
)
|
||||
endif()
|
46
modules/nrf_wifi/bus/Kconfig
Normal file
46
modules/nrf_wifi/bus/Kconfig
Normal file
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Copyright (c) 2024 Nordic Semiconductor
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
DT_COMPAT_NORDIC_NRF7002_QSPI := nordic,nrf7002-qspi
|
||||
DT_COMPAT_NORDIC_NRF7002_SPI := nordic,nrf7002-spi
|
||||
DT_COMPAT_NORDIC_NRF7001_QSPI := nordic,nrf7001-qspi
|
||||
DT_COMPAT_NORDIC_NRF7001_SPI := nordic,nrf7001-spi
|
||||
DT_COMPAT_NORDIC_NRF7000_QSPI := nordic,nrf7000-qspi
|
||||
DT_COMPAT_NORDIC_NRF7000_SPI := nordic,nrf7000-spi
|
||||
|
||||
menuconfig NRF70_BUSLIB
|
||||
bool "NRF70 Bus Library"
|
||||
help
|
||||
Enable the NRF70 Bus Library for the nRF7002 Wi-Fi shield.
|
||||
|
||||
if NRF70_BUSLIB
|
||||
|
||||
config NRF70_ON_QSPI
|
||||
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7002_QSPI)) ||\
|
||||
$(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7001_QSPI)) ||\
|
||||
$(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7000_QSPI))
|
||||
select NRFX_QSPI
|
||||
|
||||
config NRF70_ON_SPI
|
||||
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7002_SPI)) ||\
|
||||
$(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7001_SPI)) ||\
|
||||
$(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF7000_SPI))
|
||||
select SPI
|
||||
|
||||
module = WIFI_NRF70_BUSLIB
|
||||
module-dep = LOG
|
||||
module-str = Log level for Wi-Fi nRF70 bus library
|
||||
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
|
||||
|
||||
config WIFI_NRF70_BUSLIB_LOG_LEVEL
|
||||
# Enable error by default
|
||||
default 1
|
||||
|
||||
config NRF70_LOG_VERBOSE
|
||||
bool "Maintains the verbosity of information in logs"
|
||||
default y
|
||||
|
||||
endif # NRF70_BUSLIB
|
|
@ -12,30 +12,26 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
#include <zephyr/drivers/wifi/nrf_wifi/bus/qspi_if.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "qspi_if.h"
|
||||
#include "spi_if.h"
|
||||
|
||||
static struct qspi_config config;
|
||||
|
||||
#if defined(CONFIG_NRF70_ON_QSPI)
|
||||
static struct qspi_dev qspi = {
|
||||
.init = qspi_init,
|
||||
.deinit = qspi_deinit,
|
||||
.read = qspi_read,
|
||||
.write = qspi_write,
|
||||
.hl_read = qspi_hl_read
|
||||
};
|
||||
static struct qspi_dev qspi = {.init = qspi_init,
|
||||
.deinit = qspi_deinit,
|
||||
.read = qspi_read,
|
||||
.write = qspi_write,
|
||||
.hl_read = qspi_hl_read};
|
||||
#else
|
||||
static struct qspi_dev spim = {
|
||||
.init = spim_init,
|
||||
.deinit = spim_deinit,
|
||||
.read = spim_read,
|
||||
.write = spim_write,
|
||||
.hl_read = spim_hl_read
|
||||
};
|
||||
static struct qspi_dev spim = {.init = spim_init,
|
||||
.deinit = spim_deinit,
|
||||
.read = spim_read,
|
||||
.write = spim_write,
|
||||
.hl_read = spim_hl_read};
|
||||
#endif
|
||||
|
||||
struct qspi_config *qspi_defconfig(void)
|
|
@ -15,6 +15,7 @@
|
|||
#include <zephyr/init.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#include <zephyr/drivers/wifi/nrf_wifi/bus/qspi_if.h>
|
||||
|
||||
#include <soc.h>
|
||||
#include <nrf_erratas.h>
|
||||
|
@ -23,7 +24,6 @@
|
|||
#include <hal/nrf_gpio.h>
|
||||
|
||||
#include "spi_nor.h"
|
||||
#include "qspi_if.h"
|
||||
|
||||
/* The QSPI bus node which the NRF70 is on */
|
||||
#define QSPI_IF_BUS_NODE DT_NODELABEL(qspi)
|
||||
|
@ -152,7 +152,7 @@ static void qspi_device_uninit(const struct device *dev);
|
|||
|
||||
#define WORD_SIZE 4
|
||||
|
||||
LOG_MODULE_DECLARE(wifi_nrf_bus, CONFIG_WIFI_NRF70_BUS_LOG_LEVEL);
|
||||
LOG_MODULE_DECLARE(wifi_nrf_bus, CONFIG_WIFI_NRF70_BUSLIB_LOG_LEVEL);
|
||||
|
||||
/**
|
||||
* @brief QSPI buffer structure
|
|
@ -17,12 +17,12 @@
|
|||
#include <zephyr/devicetree.h>
|
||||
#include <zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h>
|
||||
#include <zephyr/drivers/wifi/nrf_wifi/bus/qspi_if.h>
|
||||
|
||||
#include "rpu_hw_if.h"
|
||||
#include "qspi_if.h"
|
||||
#include "spi_if.h"
|
||||
|
||||
LOG_MODULE_REGISTER(wifi_nrf_bus, CONFIG_WIFI_NRF70_BUS_LOG_LEVEL);
|
||||
LOG_MODULE_REGISTER(wifi_nrf_bus, CONFIG_WIFI_NRF70_BUSLIB_LOG_LEVEL);
|
||||
|
||||
#define NRF7002_NODE DT_NODELABEL(nrf70)
|
||||
|
||||
|
@ -44,7 +44,7 @@ uint32_t rpu_7002_memmap[][3] = {
|
|||
{ 0x009000, 0x03FFFF, 2 },
|
||||
{ 0x040000, 0x07FFFF, 1 },
|
||||
{ 0x0C0000, 0x0F0FFF, 0 },
|
||||
{ 0x080000, 0x092000, 1 },
|
||||
{ 0x080000, 0x092000, 2 },
|
||||
{ 0x100000, 0x134000, 1 },
|
||||
{ 0x140000, 0x14C000, 1 },
|
||||
{ 0x180000, 0x190000, 1 },
|
||||
|
@ -483,11 +483,16 @@ int rpu_enable(void)
|
|||
goto rpu_pwroff;
|
||||
}
|
||||
|
||||
/* TODO: rpu_validate_comms() needs firmware download to be done
|
||||
* successfully before it can be called. So, disable this for
|
||||
* nrf70_buslib only usage.
|
||||
*/
|
||||
#ifdef CONFIG_WIFI_NRF70
|
||||
ret = rpu_validate_comms();
|
||||
if (ret) {
|
||||
goto rpu_pwroff;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
rpu_pwroff:
|
||||
rpu_pwroff();
|
|
@ -13,11 +13,11 @@
|
|||
|
||||
#include <zephyr/drivers/spi.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/drivers/wifi/nrf_wifi/bus/qspi_if.h>
|
||||
|
||||
#include "qspi_if.h"
|
||||
#include "spi_if.h"
|
||||
|
||||
LOG_MODULE_DECLARE(wifi_nrf_bus, CONFIG_WIFI_NRF70_BUS_LOG_LEVEL);
|
||||
LOG_MODULE_DECLARE(wifi_nrf_bus, CONFIG_WIFI_NRF70_BUSLIB_LOG_LEVEL);
|
||||
|
||||
#define NRF7002_NODE DT_NODELABEL(nrf70)
|
||||
|
186
modules/nrf_wifi/os/CMakeLists.txt
Normal file
186
modules/nrf_wifi/os/CMakeLists.txt
Normal file
|
@ -0,0 +1,186 @@
|
|||
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
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>
|
||||
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_REG_DOMAIN=${CONFIG_NRF70_REG_DOMAIN}
|
||||
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}
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
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)
|
|
@ -18,13 +18,13 @@
|
|||
#include <zephyr/drivers/gpio.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/sys/__assert.h>
|
||||
#include <zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h>
|
||||
#include <zephyr/drivers/wifi/nrf_wifi/bus/qspi_if.h>
|
||||
|
||||
#include "rpu_hw_if.h"
|
||||
#include "shim.h"
|
||||
#include "work.h"
|
||||
#include "timer.h"
|
||||
#include "osal_ops.h"
|
||||
#include "qspi_if.h"
|
||||
|
||||
LOG_MODULE_REGISTER(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue