-
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,716 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,14 @@ | ||
.. _nrf_wifi_api: | ||
|
||
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 on 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__ */ |
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,55 @@ | ||
/* | ||
* Copyright (c) 2022 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* @brief Header containing the structure declarations for the Bus Abstraction | ||
* Layer (BAL) of the Wi-Fi driver. | ||
*/ | ||
|
||
#ifndef __BAL_STRUCTS_H__ | ||
#define __BAL_STRUCTS_H__ | ||
|
||
#include "osal_ops.h" | ||
#include "bal_ops.h" | ||
|
||
struct nrf_wifi_bal_cfg_params { | ||
unsigned long addr_pktram_base; | ||
}; | ||
|
||
/** | ||
* struct nrf_wifi_bal_priv - Structure to hold context information for the BAL | ||
* @opriv: Pointer to the OSAL context. | ||
* @bus_priv: Pointer to a specific bus context. | ||
* @ops: Pointer to bus operations to be provided by a specific bus | ||
* implementation. | ||
* | ||
* This structure maintains the context information necessary for the | ||
* operation of the BAL. Some of the elements of the structure need to be | ||
* initialized during the initialization of the BAL while others need to | ||
* be kept updated over the duration of the BAL operation. | ||
*/ | ||
struct nrf_wifi_bal_priv { | ||
struct nrf_wifi_osal_priv *opriv; | ||
void *bus_priv; | ||
struct nrf_wifi_bal_ops *ops; | ||
|
||
enum nrf_wifi_status (*init_dev_callbk_fn)(void *ctx); | ||
|
||
void (*deinit_dev_callbk_fn)(void *ctx); | ||
|
||
enum nrf_wifi_status (*intr_callbk_fn)(void *ctx); | ||
}; | ||
|
||
|
||
struct nrf_wifi_bal_dev_ctx { | ||
struct nrf_wifi_bal_priv *bpriv; | ||
void *hal_dev_ctx; | ||
void *bus_dev_ctx; | ||
#ifdef CONFIG_NRF_WIFI_LOW_POWER | ||
bool rpu_fw_booted; | ||
#endif /* CONFIG_NRF_WIFI_LOW_POWER */ | ||
}; | ||
#endif /* __BAL_STRUCTS_H__ */ |
Oops, something went wrong.