-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wifi: Move OS agnostic code from nrf700x Wi-Fi driver
OS agnostic code was in sdk-nrf: drivers/wifi/nrf700x/osal but as this is common move to nrfxlib and also modify the license to 3 clause BSD so that it can be used with non-nordic MCUs, Zephyr or otherwise. Also, move the drivers documentation and update CODEOWNERS. Fixes SHEL-1763. Signed-off-by: Chaitanya Tata <[email protected]>
- Loading branch information
Showing
74 changed files
with
36,867 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
.. _nrf_wifi: | ||
|
||
nRF70 Series Wi-Fi driver | ||
######################### | ||
|
||
.. contents:: | ||
:local: | ||
:depth: 2 | ||
|
||
This driver implements the Wi-Fi® protocol for the nRF70 FullMAC Series of devices. | ||
FullMAC devices implement the Wi-Fi protocol in the chipset. | ||
The driver configures the chipset and transfers the frames to and from the device to the networking stack. | ||
|
||
nRF70 Series device is a companion IC and can be used with any Nordic Semiconductor System-on-Chips (SoCs) such as the nRF53 and nRF91 Series SoCs. | ||
|
||
You can enable the driver by using the :kconfig:option:`CONFIG_WIFI_NRF700X` Kconfig option. | ||
|
||
Architecture | ||
************* | ||
|
||
The following figure illustrates the architecture of the nRF70 Series Wi-Fi driver. | ||
|
||
.. figure:: /images/nrf700x_wifi_driver.svg | ||
:alt: nRF70 Series Wi-Fi driver block diagram | ||
:align: center | ||
:figclass: align-center | ||
|
||
nRF70 Series Wi-Fi driver architecture overview | ||
|
||
Design overview | ||
*************** | ||
|
||
The nRF70 Series Wi-Fi driver follows an OS agnostic design, and the driver implementation is split into OS agnostic and OS (Zephyr) specific code. | ||
The OS agnostic code is located in the :ref:`nrfxlib:nrf_wifi` and the OS specific code is located in the :file:`drivers/wifi/nrf700x/`. | ||
|
||
The driver supports two modes of operations: | ||
|
||
Wi-Fi mode | ||
========== | ||
In this mode, the driver is designed to be used with the Zephyr networking stack. | ||
It is implemented as a network interface driver. | ||
|
||
The driver supports the following IEEE 802.11 features: | ||
|
||
* Wi-Fi 6 (802.11ax) support | ||
* WPA3/WPA2 personal security | ||
* IEEE 802.11 Power Save modes | ||
* Scan only mode | ||
* IEEE 802.11 Station (STA) mode | ||
|
||
The following features are in the driver code but not yet supported: | ||
|
||
* IEEE 802.11 AP mode (Soft AP) | ||
* Wi-Fi Direct mode | ||
|
||
Except for scan only mode, the driver uses host access point daemon (hostapd) to implement AP Media Access Control (MAC) Sublayer Management Entity (AP MLME) and wpa_supplicant to implement 802.1X supplicant. | ||
|
||
Radio Test mode | ||
=============== | ||
The nRF70 Series Wi-Fi driver supports Radio Test mode, which you can use to test the RF performance of the nRF70 Series device. | ||
This is a build time option that you can enable using the :kconfig:option:`CONFIG_NRF700X_RADIO_TEST` Kconfig option. | ||
|
||
Driver to nRF70 Series device communication | ||
******************************************* | ||
|
||
The driver communicates with the nRF70 Series device using the QSPI/SPI interface. | ||
The driver uses the QSPI/SPI interface to send commands to the nRF70 Series device, and to transfer the data to and from the device. | ||
The nRF7002 DK uses QSPI whereas the nRF7002 EK uses SPI. | ||
|
||
To connect the nRF7002 EK to the SoC, the ``nrf7002ek`` shield is required. | ||
|
||
Configuration | ||
************* | ||
|
||
The nRF70 Series Wi-Fi driver has the following configuration options: | ||
|
||
Kconfig configuration | ||
===================== | ||
|
||
.. options-from-kconfig:: | ||
:show-type: | ||
|
||
Devicetree Specification configuration | ||
====================================== | ||
|
||
The maximum transmit power achieved on a nRF70 Series device-based product depends on the frequency band and operating channel. | ||
This varies from chip to chip as well as over different `Printed Circuit Board (PCB)` designs. | ||
|
||
Multiple calibrations and checks are implemented to ensure consistency across channels and devices. | ||
However, these values have a dependency on PCB design, which may result in Error Vector Magnitude (EVM) and spectral mask failures. | ||
To avoid this problem, you can specify the power ceiling at which the EVM and spectral mask are met for a given PCB design. | ||
Additionally, build-time parameters are made available to drivers through the DTS overlay file. | ||
|
||
The following code snippet shows an example of the DTS overlay file: | ||
|
||
.. code-block:: devicetree | ||
/ | ||
{ | ||
nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { | ||
status = "okay"; | ||
compatible = "nordic,nrf700x-tx-power-ceiling"; | ||
max-pwr-2g-dsss = <0x54>; | ||
max-pwr-2g-mcs0 = <0x40>; | ||
max-pwr-2g-mcs7 = <0x40>; | ||
max-pwr-5g-low-mcs0 = <0x38>; | ||
max-pwr-5g-low-mcs7 = <0x38>; | ||
max-pwr-5g-mid-mcs0 = <0x38>; | ||
max-pwr-5g-mid-mcs7 = <0x38>; | ||
max-pwr-5g-high-mcs0 = <0x38>; | ||
max-pwr-5g-high-mcs7 = <0x38>; | ||
}; | ||
}; | ||
The following table lists the parameters (8-bit unsigned values) defined in the DTS overlay board files: | ||
|
||
.. list-table:: DTS file parameters | ||
:header-rows: 1 | ||
|
||
* - DTS parameter | ||
- Description | ||
* - max-pwr-2g-dsss | ||
- Transmit power ceiling for DSSS data rate in 0.25 dBm steps. | ||
This is applicable for all DSSS data rates. | ||
* - max-pwr-2g-mcs0 | ||
- Transmit power ceiling for MCS0 data rate in 2.4 GHz band in steps of 0.25 dBm steps. | ||
* - max-pwr-2g-mcs7 | ||
- Transmit power ceiling for MCS7 data rate in 2.4 GHz band in steps of 0.25 dBm steps. | ||
* - max-pwr-5g-low-mcs0 | ||
- Transmit power ceiling for MCS0 in lower 5 GHz frequency band in steps of 0.25 dBm. | ||
Lower 5 GHz frequency band refers to channels from 36 to 64. | ||
* - max-pwr-5g-low-mcs7 | ||
- Transmit power ceiling for MCS7 in lower 5 GHz frequency band in steps of 0.25 dBm. | ||
* - max-pwr-5g-mid-mcs0 | ||
- Transmit power ceiling for MCS0 in mid 5 GHz frequency band in steps of 0.25 dBm. | ||
Mid 5 GHz frequency band refers to channels from 100 to 132. | ||
* - max-pwr-5g-mid-mcs7 | ||
- Transmit power ceiling for MCS7 in mid 5 GHz frequency band in steps of 0.25 dBm. | ||
* - max-pwr-5g-high-mcs0 | ||
- Transmit power ceiling for MCS0 in high 5 GHz frequency band in steps of 0.25 dBm. | ||
High 5 GHz frequency band refers to channels from 136 to 177. | ||
* - max-pwr-5g-mid-mcs7 | ||
- Transmit power ceiling for MCS7 in mid 5 GHz frequency band in steps of 0.25 dBm. | ||
|
||
|
||
API documentation | ||
***************** | ||
|
||
After the nRF70 Series driver has been initialized, the application will see it as an Ethernet interface. | ||
To use the Ethernet interface, the application can use `Zephyr Network APIs`_. | ||
|
||
Low-level API documentation | ||
*************************** | ||
|
||
The nRF70 Series Wi-Fi driver provides a low-level API for use cases where the application needs to access the nRF70 Series device directly. | ||
This is typically intended for customers who want to use the nRF70 Series device in a different platform than Zephyr. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Modules: | ||
:glob: | ||
|
||
doc/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright (c) 2022 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* @brief Header containing the API declarations for the Bus Abstraction Layer | ||
* (BAL) of the Wi-Fi driver. | ||
*/ | ||
|
||
#ifndef __BAL_API_H__ | ||
#define __BAL_API_H__ | ||
|
||
#include "osal_api.h" | ||
#include "bal_structs.h" | ||
|
||
/** | ||
* nrf_wifi_bal_init() - Initialize the BAL layer. | ||
* | ||
* @intr_callbk_fn: Pointer to the callback function which the user of this | ||
* layer needs to implement to handle interrupts from the | ||
* RPU. | ||
* | ||
* This API is used to initialize the BAL layer and is expected to be called | ||
* before using the BAL layer. This API returns a pointer to the BAL context | ||
* which might need to be passed to further API calls. | ||
* | ||
* Returns: Pointer to instance of BAL layer context. | ||
*/ | ||
struct nrf_wifi_bal_priv *nrf_wifi_bal_init(struct nrf_wifi_osal_priv *opriv, | ||
struct nrf_wifi_bal_cfg_params *cfg_params, | ||
enum nrf_wifi_status (*intr_callbk_fn)(void *hal_ctx)); | ||
|
||
|
||
/** | ||
* nrf_wifi_bal_deinit() - Deinitialize the BAL layer. | ||
* @bpriv: Pointer to the BAL layer context returned by the | ||
* @nrf_wifi_bal_init API. | ||
* | ||
* This API is used to deinitialize the BAL layer and is expected to be called | ||
* after done using the BAL layer. | ||
* | ||
* Returns: None. | ||
*/ | ||
void nrf_wifi_bal_deinit(struct nrf_wifi_bal_priv *bpriv); | ||
|
||
|
||
struct nrf_wifi_bal_dev_ctx *nrf_wifi_bal_dev_add(struct nrf_wifi_bal_priv *bpriv, | ||
void *hal_dev_ctx); | ||
|
||
void nrf_wifi_bal_dev_rem(struct nrf_wifi_bal_dev_ctx *bal_dev_ctx); | ||
|
||
enum nrf_wifi_status nrf_wifi_bal_dev_init(struct nrf_wifi_bal_dev_ctx *bal_dev_ctx); | ||
|
||
void nrf_wifi_bal_dev_deinit(struct nrf_wifi_bal_dev_ctx *bal_dev_ctx); | ||
|
||
unsigned int nrf_wifi_bal_read_word(void *ctx, | ||
unsigned long addr_offset); | ||
|
||
void nrf_wifi_bal_write_word(void *ctx, | ||
unsigned long addr_offset, | ||
unsigned int val); | ||
|
||
void nrf_wifi_bal_read_block(void *ctx, | ||
void *dest_addr, | ||
unsigned long src_addr_offset, | ||
size_t len); | ||
|
||
void nrf_wifi_bal_write_block(void *ctx, | ||
unsigned long dest_addr_offset, | ||
const void *src_addr, | ||
size_t len); | ||
|
||
unsigned long nrf_wifi_bal_dma_map(void *ctx, | ||
unsigned long virt_addr, | ||
size_t len, | ||
enum nrf_wifi_osal_dma_dir dma_dir); | ||
|
||
unsigned long nrf_wifi_bal_dma_unmap(void *ctx, | ||
unsigned long phy_addr, | ||
size_t len, | ||
enum nrf_wifi_osal_dma_dir dma_dir); | ||
|
||
void nrf_wifi_bal_bus_access_rec_enab(void *ctx); | ||
|
||
void nrf_wifi_bal_bus_access_rec_disab(void *ctx); | ||
|
||
void nrf_wifi_bal_bus_access_cnt_print(void *ctx); | ||
|
||
#ifdef CONFIG_NRF_WIFI_LOW_POWER | ||
void nrf_wifi_bal_rpu_ps_sleep(void *ctx); | ||
|
||
void nrf_wifi_bal_rpu_ps_wake(void *ctx); | ||
|
||
int nrf_wifi_bal_rpu_ps_status(void *ctx); | ||
#endif /* CONFIG_NRF_WIFI_LOW_POWER */ | ||
#endif /* __BAL_API_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (c) 2022 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* @brief Header containing the OPs declarations for the Bus Abstraction Layer | ||
* (BAL) of the Wi-Fi driver. | ||
*/ | ||
|
||
#ifndef __BAL_OPS_H__ | ||
#define __BAL_OPS_H__ | ||
|
||
#include <stdbool.h> | ||
|
||
/** | ||
* struct nrf_wifi_bal_ops - Ops to be provided by a particular bus | ||
* implementation. | ||
* @init: | ||
* @deinit: | ||
* @dev_init: | ||
* @dev_deinit: | ||
* @read_word: | ||
* @write_word: | ||
* @read_block: | ||
* @write_block: | ||
* @dma_map: | ||
* @dma_unmap: | ||
*/ | ||
struct nrf_wifi_bal_ops { | ||
void * (*init)(struct nrf_wifi_osal_priv *opriv, | ||
void *cfg_params, | ||
enum nrf_wifi_status (*intr_callbk_fn)(void *hal_ctx)); | ||
void (*deinit)(void *bus_priv); | ||
void * (*dev_add)(void *bus_priv, | ||
void *bal_dev_ctx); | ||
void (*dev_rem)(void *bus_dev_ctx); | ||
|
||
enum nrf_wifi_status (*dev_init)(void *bus_dev_ctx); | ||
void (*dev_deinit)(void *bus_dev_ctx); | ||
unsigned int (*read_word)(void *bus_dev_ctx, | ||
unsigned long addr_offset); | ||
void (*write_word)(void *bus_dev_ctx, | ||
unsigned long addr_offset, | ||
unsigned int val); | ||
void (*read_block)(void *bus_dev_ctx, | ||
void *dest_addr, | ||
unsigned long src_addr_offset, | ||
size_t len); | ||
void (*write_block)(void *bus_dev_ctx, | ||
unsigned long dest_addr_offset, | ||
const void *src_addr, | ||
size_t len); | ||
unsigned long (*dma_map)(void *bus_dev_ctx, | ||
unsigned long virt_addr, | ||
size_t len, | ||
enum nrf_wifi_osal_dma_dir dma_dir); | ||
unsigned long (*dma_unmap)(void *bus_dev_ctx, | ||
unsigned long phy_addr, | ||
size_t len, | ||
enum nrf_wifi_osal_dma_dir dma_dir); | ||
#ifdef CONFIG_NRF_WIFI_LOW_POWER | ||
void (*rpu_ps_sleep)(void *bus_dev_ctx); | ||
void (*rpu_ps_wake)(void *bus_dev_ctx); | ||
int (*rpu_ps_status)(void *bus_dev_ctx); | ||
#endif /* CONFIG_NRF_WIFI_LOW_POWER */ | ||
}; | ||
|
||
|
||
/** | ||
* get_bus_ops() - The BAL layer expects this Op return a initialized instance | ||
* of Bus specific Ops. | ||
* | ||
* This Op is expected to be implemented by a specific Bus shim and is expected | ||
* to return a pointer to a initialized instance of struct nrf_wifi_bal_ops. | ||
* | ||
* Returns: Pointer to instance of Bus specific Ops. | ||
*/ | ||
struct nrf_wifi_bal_ops *get_bus_ops(void); | ||
#endif /* __BAL_OPS_H__ */ |
Oops, something went wrong.