API documentation
nRF70 Bare Metal library.
Defines
-
NRF70_LOG_ERR(...)
Log levels.
-
NRF70_LOG_WRN(...)
-
NRF70_LOG_INF(...)
-
NRF70_LOG_DBG(...)
-
NR70_SCAN_SSID_MAX_LEN
-
NR70_MAC_ADDR_LEN
-
NRF70_SCAN_MAX_BSS_CNT
-
NRF70_SCAN_SSID_FILT_MAX
-
NRF70_SCAN_CHAN_MAX_MANUAL
-
NRF70_MAX_CHANNELS
Maximum number of channels supported by the Wi-Fi chip - 2.4GHz + 5GHz.
Typedefs
-
typedef void (*nrf70_scan_result_cb_t)(struct nrf70_scan_result *entry)
Callback function to be called when a scan result is available.
- Param entry:
[in] Scan result entry. NULL if scan is done.
Enums
-
enum nrf70_security_type
IEEE 802.11 security types.
Values:
-
enumerator NRF70_SECURITY_TYPE_NONE
No security.
-
enumerator NRF70_SECURITY_TYPE_PSK
WPA2-PSK security.
-
enumerator NRF70_SECURITY_TYPE_PSK_SHA256
WPA2-PSK-SHA256 security.
-
enumerator NRF70_SECURITY_TYPE_SAE
WPA3-SAE security.
-
enumerator NRF70_SECURITY_TYPE_WAPI
GB 15629.11-2003 WAPI security.
-
enumerator NRF70_SECURITY_TYPE_EAP
EAP security - Enterprise.
-
enumerator NRF70_SECURITY_TYPE_WEP
WEP security.
-
enumerator NRF70_SECURITY_TYPE_WPA_PSK
WPA-PSK security.
-
enumerator NRF70_SECURITY_TYPE_WPA_AUTO_PERSONAL
WPA/WPA2/WPA3 PSK security.
-
enumerator NRF70_SECURITY_TYPE_NONE
-
enum nrf70_mfp_options
IEEE 802.11w - Management frame protection.
Values:
-
enumerator NRF70_MFP_DISABLE
MFP disabled.
-
enumerator NRF70_MFP_OPTIONAL
MFP optional.
-
enumerator NRF70_MFP_REQUIRED
MFP required.
-
enumerator NRF70_MFP_DISABLE
-
enum nrf70_frequency_bands
IEEE 802.11 operational frequency bands (not exhaustive).
Values:
-
enumerator NRF70_FREQ_BAND_2_4_GHZ
2.4 GHz band.
-
enumerator NRF70_FREQ_BAND_5_GHZ
5 GHz band.
-
enumerator NRF70_FREQ_BAND_6_GHZ
6 GHz band (Wi-Fi 6E, also extends to 7GHz).
-
enumerator __NRF70_FREQ_BAND_AFTER_LAST
Number of frequency bands available.
-
enumerator NRF70_FREQ_BAND_MAX
Highest frequency band available.
-
enumerator NRF70_FREQ_BAND_UNKNOWN
Invalid frequency band
-
enumerator NRF70_FREQ_BAND_2_4_GHZ
Functions
-
const char *nrf70_security_txt(enum nrf70_security_type security)
Helper function to get user-friendly security type name.
-
const char *nrf70_mfp_txt(enum nrf70_mfp_options mfp)
Helper function to get user-friendly MFP name.
-
const char *nrf70_band_txt(enum nrf70_frequency_bands band)
Helper function to get user-friendly frequency band name.
-
int nrf70_bm_init(uint8_t *mac_addr, struct nrf70_regulatory_info *reg_info)
Initialize the WiFi module.
This function initializes the nRF70 device and prepares it for operation. This also includes powering up the device and setting up the necessary configurations including the download of the firmware patch for nRF70 device.
- Parameters:
mac_addr – [in] MAC address of the device.
reg_info – [in] Regulatory information.
- Return values:
0 – If the operation was successful.
-1 – If the operation failed.
-
int nrf70_bm_scan_start(struct nrf70_scan_params *scan_params, nrf70_scan_result_cb_t cb)
Start scanning for WiFi networks.
If all the bands and channels as specified in the scan parameters are scanned, the scan will be considered complete and the callback function will be called with each scan result and finally with a NULL entry to indicate that the scan is done.
Once the scan is complete, after a timeout the nRF70 device will automatically switch to sleep state.
- Parameters:
scan_params – [in] Scan parameters.
cb – [in] Callback function to be called when a scan result is available.
- Return values:
0 – If the operation was successful.
-EINVAL – If the scan parameters are invalid.
-EBUSY – If the scan is already in progress.
-EIO – If the operation failed.
-ENOMEM – If there is not enough memory to start the scan.
-
int nrf70_bm_set_reg(struct nrf70_regulatory_info *reg_info)
Set nRF70 regulatory information.
This function sets the regulatory information of the nRF70 device. The regulatory information includes the country code, the number of channels supported and the channel information.
- Parameters:
reg_info – [in] Regulatory information.
- Return values:
0 – If the operation was successful.
-1 – If the operation failed.
-
int nrf70_bm_get_reg(struct nrf70_regulatory_info *reg_info)
Get nRF70 regulatory information.
This function retrieves the regulatory information of the nRF70 device. The regulatory information includes the country code, the number of channels supported and the channel information.
- Parameters:
reg_info – [out] Regulatory information.
- Return values:
0 – If the operation was successful.
-1 – If the operation failed. *
-
int nrf70_bm_deinit(void)
Clean up the WiFi module.
This function de-initializes the nRF70 device, free up resources and powers it down. Any further operations on the device will require re-initialization.
- Return values:
0 – If the operation was successful.
-
void nrf70_bm_mac_txt(const unsigned char *mac, char *mac_str, size_t size)
Convert a MAC address to a string.
- Parameters:
mac – [in] MAC address.
mac_str – [out] MAC address string.
size – [in] Size of the MAC address string.
-
int nrf70_bm_dump_stats(const char *type)
Get the nRF70 statistics.
This function retrieves the statistics of the nRF70 device for UMAC, LMAc and PHY.
- Parameters:
type – [in] Type of statistics to get.
- Return values:
0 – If the operation was successful.
-EINVAL – If the type is invalid.
-EIO – If the operation failed.
-
struct nrf70_version
- #include <nrf70_bm_lib.h>
nRF70 version structure.
-
struct nrf70_band_channel
- #include <nrf70_bm_lib.h>
Wi-Fi structure to uniquely identify a band-channel pair.
-
struct nrf70_scan_params
- #include <nrf70_bm_lib.h>
Wi-Fi scan parameters structure. Used to specify parameters which can control how the Wi-Fi scan is performed.
Public Members
-
enum nrf70_scan_type scan_type
Scan type, see enum nrf70_scan_type.
The scan_type is only a hint to the underlying Wi-Fi chip for the preferred mode of scan. The actual mode of scan can depend on factors such as the Wi-Fi chip implementation support, regulatory domain restrictions etc.
-
uint8_t bands
Bitmap of bands to be scanned. Refer to nrf70_frequency_bands for bit position of each band.
-
uint16_t dwell_time_active
Active scan dwell time (in ms) on a channel - default 50ms
-
uint16_t dwell_time_passive
Passive scan dwell time (in ms) on a channel - default 130ms
-
const char *ssids[NRF70_SCAN_SSID_FILT_MAX]
Array of SSID strings to scan.
-
uint16_t max_bss_cnt
Specifies the maximum number of scan results to return. These results would be the BSSIDS with the best RSSI values, in all the scanned channels. This should only be used to limit the number of returned scan results, and cannot be counted upon to limit the scan time, since the underlying Wi-Fi chip might have to scan all the channels to find the max_bss_cnt number of APs with the best signal strengths. A value of 0 signifies that there is no restriction on the number of scan results to be returned.
-
struct nrf70_band_channel band_chan[NRF70_SCAN_CHAN_MAX_MANUAL]
Channel information array indexed on Wi-Fi frequency bands and channels within that band. E.g. to scan channel 6 and 11 on the 2.4 GHz band, channel 36 on the 5 GHz band:
chan[0] = {NRF70FREQ_BAND_2_4_GHZ, 6}; chan[1] = {NRF70FREQ_BAND_2_4_GHZ, 11}; chan[2] = {NRF70FREQ_BAND_5_GHZ, 36};
This list specifies the channels to be considered for scan. The underlying Wi-Fi chip can silently omit some channels due to various reasons such as channels not conforming to regulatory restrictions etc. The invoker of the API should ensure that the channels specified follow regulatory rules.
-
enum nrf70_scan_type scan_type
-
struct nrf70_scan_result
- #include <nrf70_bm_lib.h>
Wi-Fi scan result, each result is provided to the net_mgmt_event_callback via its info attribute (see net_mgmt.h)
Public Members
-
uint8_t ssid[NR70_SCAN_SSID_MAX_LEN]
SSID
-
uint8_t ssid_len
SSID length
-
uint8_t band
Frequency band
-
uint8_t channel
Channel
-
enum nrf70_security_type security
Security type
-
enum nrf70_mfp_options mfp
MFP options
-
int8_t rssi
RSSI
-
uint8_t bssid[NR70_MAC_ADDR_LEN]
BSSID
-
uint8_t ssid[NR70_SCAN_SSID_MAX_LEN]
-
struct nrf70_reg_chan_info
- #include <nrf70_bm_lib.h>
Per-channel regulatory attributes.
-
struct nrf70_regulatory_info
- #include <nrf70_bm_lib.h>
Regulatory information.
Public Members
-
char country_code[2]
Country code - ISO/IEC 3166-1 alpha-2
-
bool force
Force - ignore 802.11d beacon hints (only used in SET)
-
unsigned int num_channels
Number of channels supported (only used in GET)
-
struct nrf70_reg_chan_info *chan_info
Channels information (only used in GET)
-
char country_code[2]