Networking Libraries
Functions for implementing networking
Integration/wrapper libraries for BTstack the documentation for which is here. |
|
Integration/wrapper libraries for lwIP the documentation for which is here. |
|
lwIP compiler adapters. This is not included by default in |
|
LwIP HTTP client and server library. |
|
Glue library for integration lwIP in |
|
Glue library for integration lwIP in |
|
A wrapper around the lower level cyw43_driver, that integrates it with pico_async_context for handling background work. |
|
Low-level Bluetooth HCI support. |
|
Architecture for integrating the CYW43 driver (for the wireless on Pico W) and lwIP (for TCP/IP stack) into the SDK. It is also necessary for accessing the on-board LED on Pico W. |
|
Driver used for Pico W wireless. |
|
Low Level CYW43 driver interface. |
pico_btstack
Detailed Description
A supplemental license for BTstack (in addition to the stock BTstack licensing terms) is provided here.
The pico_btstack_ble library adds the support needed for Bluetooth Low Energy (BLE). The pico_btstack_classic library adds the support needed for Bluetooth Classic. You can link to either library individually, or to both libraries thus enabling dual-mode support provided by BTstack.
To use BTstack you need to provide a btstack_config.h file in your source tree and add its location to your include path. The BTstack configuration macros ENABLE_CLASSIC and ENABLE_BLE are defined for you when you link the pico_btstack_classic and pico_btstack_ble libraries respectively, so you should not define them yourself.
For more details, see How to configure BTstack and the relevant pico-examples.
The follow libraries are provided for you to link.
-
pico_btstack_ble -Adds Bluetooth Low Energy (LE) support. -
pico_btstack_classic -Adds Bluetooth Classic support. -
pico_btstack_sbc_encoder -Adds Bluetooth Sub Band Coding (SBC) encoder support. -
pico_btstack_sbc_decoder -Adds Bluetooth Sub Band Coding (SBC) decoder support. -
pico_btstack_bnep_lwip -Adds Bluetooth Network Encapsulation Protocol (BNEP) support using LwIP. -
pico_btstack_bnep_lwip_sys_freertos -Adds Bluetooth Network Encapsulation Protocol (BNEP) support using LwIP with FreeRTOS for NO_SYS=0. -
pico_btstack_mesh -Adds Bluetooth mesh support from BTstack.
|
Note
|
The CMake function pico_btstack_make_gatt_header can be used to run the BTstack compile_gatt tool to make a GATT header file from a BTstack GATT file. |
See also
pico_btstack_cyw43 in pico_cyw43_driver, which adds the cyw43 driver support needed for BTstack including BTstack run loop support.
Functions
const hal_flash_bank_t * pico_flash_bank_instance (void)-
Return the singleton BTstack HAL flash instance, used for non-volatile storage.
const btstack_run_loop_t * btstack_run_loop_async_context_get_instance (async_context_t *context)-
Initialize and return the singleton BTstack run loop instance that integrates with the async_context API.
void btstack_run_loop_async_context_deinit (void)-
Deinitialize the BTstack state to stop it using the async_context API.
const btstack_chipset_t * btstack_chipset_cyw43_instance (void)-
Return the singleton BTstack chipset CY43 API instance.
Function Documentation
btstack_chipset_cyw43_instance
const btstack_chipset_t * btstack_chipset_cyw43_instance (void)
Return the singleton BTstack chipset CY43 API instance.
btstack_run_loop_async_context_deinit
void btstack_run_loop_async_context_deinit (void)
Deinitialize the BTstack state to stop it using the async_context API.
btstack_run_loop_async_context_get_instance
const btstack_run_loop_t * btstack_run_loop_async_context_get_instance (async_context_t * context)
Initialize and return the singleton BTstack run loop instance that integrates with the async_context API.
Parameters
context
|
the async_context instance that provides the abstraction for handling asynchronous work. |
Returns
the BTstack run loop instance
pico_flash_bank_instance
const hal_flash_bank_t * pico_flash_bank_instance (void)
Return the singleton BTstack HAL flash instance, used for non-volatile storage.
|
Note
|
By default, two sectors near the end of flash are used. For RP2350 when PICO_RP2350_A2_SUPPORTED is true, two sectors that are three sectors from the end of flash are used. This keeps the last sector free for a workaround for chip errata RP2350-E10. See the RP2350 datasheet for more details about this. Otherwise, two sectors directly at the end of flash are used. See |
pico_lwip
Detailed Description
The main pico_lwip library itself aggregates the lwIP RAW API: pico_lwip_core, pico_lwip_core4, pico_lwip_core6, pico_lwip_api, pico_lwip_netif, pico_lwip_sixlowpan and pico_lwip_ppp.
If you wish to run in NO_SYS=1 mode, then you can link pico_lwip along with pico_lwip_nosys.
If you wish to run in NO_SYS=0 mode, then you can link pico_lwip with (for instance) pico_lwip_freertos, and also link in pico_lwip_api for the additional blocking/thread-safe APIs.
Additionally you must link in pico_lwip_arch unless you provide your own compiler bindings for lwIP.
Additional individual pieces of lwIP functionality are available à la cart, by linking any of the libraries below.
The following libraries are provided that contain exactly the equivalent lwIP functionality groups:
-
pico_lwip_core - -
pico_lwip_core4 - -
pico_lwip_core6 - -
pico_lwip_netif - -
pico_lwip_sixlowpan - -
pico_lwip_ppp - -
pico_lwip_api -
The following libraries are provided that contain exactly the equivalent lwIP application support:
-
pico_lwip_snmp - -
pico_lwip_http - -
pico_lwip_makefsdata - -
pico_lwip_iperf - -
pico_lwip_smtp - -
pico_lwip_sntp - -
pico_lwip_mdns - -
pico_lwip_netbios - -
pico_lwip_tftp - -
pico_lwip_mbedtls - -
pico_lwip_mqtt -
Modules
- pico_lwip_arch
-
lwIP compiler adapters. This is not included by default in
pico_lwip incase you wish to implement your own. - pico_lwip_http
-
LwIP HTTP client and server library.
- pico_lwip_freertos
-
Glue library for integration lwIP in
NO_SYS=0mode with the SDK. - pico_lwip_nosys
-
Glue library for integration lwIP in
NO_SYS=1mode with the SDK.
pico_lwip_arch
lwIP compiler adapters. This is not included by default in pico_lwip in case you wish to implement your own.
pico_lwip_http
LwIP HTTP client and server library.
Detailed Description
This library enables you to make use of the LwIP HTTP client and server library
LwIP HTTP server
To make use of the LwIP HTTP server you need to provide the HTML that the server will return to the client. This is done by compiling the content directly into the executable.
makefsdata
LwIP provides a c-library tool makefsdata to compile your HTML into a source file for inclusion into your program. This is quite hard to use as you need to compile the tool as a native binary, then run the tool to generate a source file before compiling your code for the Pico device.
pico_set_lwip_httpd_content
To make this whole process easier, a python script makefsdata.py is provided to generate a source file for your HTML content. A CMake function pico_set_lwip_httpd_content takes care of running the makefsdata.py python script for you. To make use of this, specify the name of the source file as pico_fsdata.inc in lwipopts.h.
1
#define HTTPD_FSDATA_FILE "pico_fsdata.inc"
Then call the CMake function pico_set_lwip_httpd_content in your CMakeLists.txt to add your content to a library. Make sure you add this library to your executable by adding it to your target_link_libraries list. Here is an example from the httpd example in pico-examples.
1
2
3
4
5
6
7
8
9
pico_add_library(pico_httpd_content NOFLAG)
pico_set_lwip_httpd_content(pico_httpd_content INTERFACE
${CMAKE_CURRENT_LIST_DIR}/content/404.html
${CMAKE_CURRENT_LIST_DIR}/content/index.shtml
${CMAKE_CURRENT_LIST_DIR}/content/test.shtml
${CMAKE_CURRENT_LIST_DIR}/content/ledpass.shtml
${CMAKE_CURRENT_LIST_DIR}/content/ledfail.shtml
${CMAKE_CURRENT_LIST_DIR}/content/img/rpi.png
)
pico_lwip_freertos
Glue library for integration lwIP in NO_SYS=0 mode with the SDK.
Detailed Description
Simple init and deinit are all that is required to hook up lwIP (with full blocking API support) via an async_context instance
Functions
bool lwip_freertos_init (async_context_t *context)-
Initializes lwIP (NO_SYS=0 mode) support support for FreeRTOS using the provided async_context.
void lwip_freertos_deinit (async_context_t *context)-
De-initialize lwIP (NO_SYS=0 mode) support for FreeRTOS.
Function Documentation
lwip_freertos_deinit
void lwip_freertos_deinit (async_context_t * context)
De-initialize lwIP (NO_SYS=0 mode) support for FreeRTOS.
Note that since lwIP may only be initialized once, and doesn’t itself provide a shutdown mechanism, lwIP itself may still consume resources.
It is however safe to call lwip_freertos_init again later.
Parameters
context
|
the async_context the lwip_freertos support was added to via lwip_freertos_init |
lwip_freertos_init
bool lwip_freertos_init (async_context_t * context)
Initializes lwIP (NO_SYS=0 mode) support support for FreeRTOS using the provided async_context.
If the initialization succeeds, lwip_freertos_deinit() can be called to shutdown lwIP support
Parameters
context
|
the async_context instance that provides the abstraction for handling asynchronous work. Note in general this would be an async_context_freertos instance, though it doesn’t have to be. |
Returns
true if the initialization succeeded
pico_lwip_nosys
Glue library for integration lwIP in NO_SYS=1 mode with the SDK.
Detailed Description
Simple init and deinit are all that is required to hook up lwIP via an async_context instance.
Functions
bool lwip_nosys_init (async_context_t *context)-
Initializes lwIP (NO_SYS=1 mode) support support using the provided async_context.
void lwip_nosys_deinit (async_context_t *context)-
De-initialize lwIP (NO_SYS=1 mode) support.
Function Documentation
lwip_nosys_deinit
void lwip_nosys_deinit (async_context_t * context)
De-initialize lwIP (NO_SYS=1 mode) support.
Note that since lwIP may only be initialized once, and doesn’t itself provide a shutdown mechanism, lwIP itself may still consume resources
It is however safe to call lwip_nosys_init again later.
Parameters
context
|
the async_context the lwip_nosys support was added to via lwip_nosys_init |
lwip_nosys_init
bool lwip_nosys_init (async_context_t * context)
Initializes lwIP (NO_SYS=1 mode) support support using the provided async_context.
If the initialization succeeds, lwip_nosys_deinit() can be called to shutdown lwIP support
Parameters
context
|
the async_context instance that provides the abstraction for handling asynchronous work. |
Returns
true if the initialization succeeded
pico_cyw43_driver
A wrapper around the lower level cyw43_driver, that integrates it with pico_async_context for handling background work.
Modules
- pico_btstack_cyw43
-
Low-level Bluetooth HCI support.
Functions
const hci_transport_t * hci_transport_cyw43_instance (void)-
Get the Bluetooth HCI transport instance for cyw43.
bool cyw43_driver_init (struct async_context *context)-
Initializes the lower level cyw43_driver and integrates it with the provided async_context.
void cyw43_driver_deinit (struct async_context *context)-
De-initialize the lowever level cyw43_driver and unhooks it from the async_context.
Function Documentation
cyw43_driver_deinit
void cyw43_driver_deinit (struct async_context * context)
De-initialize the lowever level cyw43_driver and unhooks it from the async_context.
Parameters
context
|
the async_context the cyw43_driver support was added to via cyw43_driver_init |
cyw43_driver_init
bool cyw43_driver_init (struct async_context * context)
Initializes the lower level cyw43_driver and integrates it with the provided async_context.
If the initialization succeeds, lwip_nosys_deinit() can be called to shutdown lwIP support
Parameters
context
|
the async_context instance that provides the abstraction for handling asynchronous work. |
Returns
true if the initialization succeeded
pico_cyw43_arch
Architecture for integrating the CYW43 driver (for the wireless on Pico W) and lwIP (for TCP/IP stack) into the SDK. It is also necessary for accessing the on-board LED on Pico W.
Detailed Description
Both the low level cyw43_driver and the lwIP stack require periodic servicing, and have limitations on whether they can be called from multiple cores/threads.
pico_cyw43_arch attempts to abstract these complications into several behavioral groups:
-
'poll' - This not multi-core/IRQ safe, and requires the user to call cyw43_arch_poll periodically from their main loop
-
'thread_safe_background' - This is multi-core/thread/task safe, and maintenance of the driver and TCP/IP stack is handled automatically in the background
-
'freertos' - This is multi-core/thread/task safe, and uses a separate FreeRTOS task to handle lwIP and and driver work.
As of right now, lwIP is the only supported TCP/IP stack, however the use of pico_cyw43_arch is intended to be independent of the particular TCP/IP stack used (and possibly Bluetooth stack used) in the future. For this reason, the integration of lwIP is handled in the base (pico_cyw43_arch) library based on the #define CYW43_LWIP used by the cyw43_driver.
|
Note
|
As of version 1.5.0 of the Raspberry Pi Pico SDK, the The connection management APIs at least may be moved to a more generic library in a future release. The locking methods are now backed by their pico_async_context equivalents, and those methods may be used interchangeably (see cyw43_arch_lwip_begin, cyw43_arch_lwip_end and cyw43_arch_lwip_check for more details). For examples of creating of your own async_context and addition of |
Whilst you can use the pico_cyw43_arch library directly and specify CYW43_LWIP (and other defines) yourself, several other libraries are made available to the build which aggregate the defines and other dependencies for you:
-
pico_cyw43_arch_lwip_poll - For using the RAW lwIP API (in
NO_SYS=1mode) without any background processing or multi-core/thread safety.The user must call cyw43_arch_poll periodically from their main loop.
This wrapper library:
-
Sets
CYW43_LWIP=1to enable lwIP support inpico_cyw43_archandcyw43_driver. -
Sets
PICO_CYW43_ARCH_POLL=1to select the polling behavior. -
Adds the
pico_lwipas a dependency to pull in lwIP.
-
-
pico_cyw43_arch_lwip_threadsafe_background - For using the RAW lwIP API (in
NO_SYS=1mode) with multi-core/thread safety, and automatic servicing of thecyw43_driverand lwIP in background.Calls into the
cyw43_driverhigh level API (cyw43.h) may be made from either core or from lwIP callbacks, however calls into lwIP (which is not thread-safe) other than those made from lwIP callbacks, must be bracketed with cyw43_arch_lwip_begin and cyw43_arch_lwip_end. It is fine to bracket calls made from within lwIP callbacks too; you just don’t have to.NotelwIP callbacks happen in a (low priority) IRQ context (similar to an alarm callback), so care should be taken when interacting with other code.
This wrapper library:
-
Sets
CYW43_LWIP=1to enable lwIP support inpico_cyw43_archandcyw43_driver -
Sets
PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1to select the thread-safe/non-polling behavior. -
Adds the pico_lwip as a dependency to pull in lwIP.
This library can also be used under the RP2040 port of FreeRTOS with lwIP in
NO_SYS=1mode (allowing you to callcyw43_driverAPIs from any task, and to call lwIP from lwIP callbacks, or from any task if you bracket the calls with cyw43_arch_lwip_begin and cyw43_arch_lwip_end. Again, you should be careful about what you do in lwIP callbacks, as you cannot call most FreeRTOS APIs from within an IRQ context. Unless you have good reason, you should probably use the full FreeRTOS integration (withNO_SYS=0) provided bypico_cyw43_arch_lwip_sys_freertos. -
-
pico_cyw43_arch_lwip_sys_freertos - For using the full lwIP API including blocking sockets in OS (
NO_SYS=0) mode, along with with multi-core/task/thread safety, and automatic servicing of thecyw43_driverand the lwIP stack.This wrapper library:
-
Sets
CYW43_LWIP=1to enable lwIP support inpico_cyw43_archandcyw43_driver. -
Sets
PICO_CYW43_ARCH_FREERTOS=1to select the NO_SYS=0 lwip/FreeRTOS integration -
Sets
LWIP_PROVIDE_ERRNO=1to provide error numbers needed for compilation without an OS -
Adds the
pico_lwipas a dependency to pull in lwIP. -
Adds the lwIP/FreeRTOS code from lwip-contrib (in the contrib directory of lwIP)
Calls into the
cyw43_driverhigh level API (cyw43.h) may be made from any task or from lwIP callbacks, but not from IRQs. Calls into the lwIP RAW API (which is not thread safe) must be bracketed with cyw43_arch_lwip_begin and cyw43_arch_lwip_end. It is fine to bracket calls made from within lwIP callbacks too; you just don’t have to.Notethis wrapper library requires you to link FreeRTOS functionality with your application yourself.
-
-
pico_cyw43_arch_none - If you do not need the TCP/IP stack but wish to use the on-board LED.
This wrapper library:
-
Sets
CYW43_LWIP=0to disable lwIP support inpico_cyw43_archandcyw43_driver
-
Modules
- cyw43_driver
-
Driver used for Pico W wireless.
Functions
int cyw43_arch_init (void)-
Initialize the CYW43 architecture.
int cyw43_arch_init_with_country (uint32_t country)-
Initialize the CYW43 architecture for use in a specific country.
void cyw43_arch_deinit (void)-
De-initialize the CYW43 architecture.
async_context_t * cyw43_arch_async_context (void)-
Return the current async_context currently in use by the cyw43_arch code.
void cyw43_arch_set_async_context (async_context_t *context)-
Set the async_context to be used by the cyw43_arch_init.
async_context_t * cyw43_arch_init_default_async_context (void)-
Initialize the default async_context for the current cyw43_arch type.
void cyw43_arch_poll (void)-
Perform any processing required by the
cyw43_driveror the TCP/IP stack. void cyw43_arch_wait_for_work_until (absolute_time_t until)-
Sleep until there is cyw43_driver work to be done.
uint32_t cyw43_arch_get_country_code (void)-
Return the country code used to initialize cyw43_arch.
void cyw43_arch_enable_sta_mode (void)-
Enables Wi-Fi STA (Station) mode.
void cyw43_arch_disable_sta_mode (void)-
Disables Wi-Fi STA (Station) mode.
void cyw43_arch_enable_ap_mode (const char *ssid, const char *password, uint32_t auth)-
Enables Wi-Fi AP (Access point) mode.
void cyw43_arch_disable_ap_mode (void)-
Disables Wi-Fi AP (Access point) mode.
int cyw43_arch_wifi_connect_blocking (const char *ssid, const char *pw, uint32_t auth)-
Attempt to connect to a wireless access point, blocking until the network is joined or a failure is detected.
int cyw43_arch_wifi_connect_bssid_blocking (const char *ssid, const uint8_t *bssid, const char *pw, uint32_t auth)-
Attempt to connect to a wireless access point specified by SSID and BSSID, blocking until the network is joined or a failure is detected.
int cyw43_arch_wifi_connect_timeout_ms (const char *ssid, const char *pw, uint32_t auth, uint32_t timeout)-
Attempt to connect to a wireless access point, blocking until the network is joined, a failure is detected or a timeout occurs.
int cyw43_arch_wifi_connect_bssid_timeout_ms (const char *ssid, const uint8_t *bssid, const char *pw, uint32_t auth, uint32_t timeout)-
Attempt to connect to a wireless access point specified by SSID and BSSID, blocking until the network is joined, a failure is detected or a timeout occurs.
int cyw43_arch_wifi_connect_async (const char *ssid, const char *pw, uint32_t auth)-
Start attempting to connect to a wireless access point.
int cyw43_arch_wifi_connect_bssid_async (const char *ssid, const uint8_t *bssid, const char *pw, uint32_t auth)-
Start attempting to connect to a wireless access point specified by SSID and BSSID.
void cyw43_arch_gpio_put (uint wl_gpio, bool value)-
Set a GPIO pin on the wireless chip to a given value.
bool cyw43_arch_gpio_get (uint wl_gpio)-
Read the value of a GPIO pin on the wireless chip.
Function Documentation
cyw43_arch_async_context
async_context_t * cyw43_arch_async_context (void)
Return the current async_context currently in use by the cyw43_arch code.
Returns
the async_context.
cyw43_arch_deinit
void cyw43_arch_deinit (void)
De-initialize the CYW43 architecture.
This method de-initializes the cyw43_driver code and de-initializes the lwIP stack (if it was enabled at build time). Note this method should always be called from the same core (or RTOS task, depending on the environment) as cyw43_arch_init.
Additionally if the cyw43_arch is using its own async_context instance, then that instance is de-initialized.
cyw43_arch_disable_ap_mode
void cyw43_arch_disable_ap_mode (void)
Disables Wi-Fi AP (Access point) mode.
This Disbles the Wi-Fi in Access Point mode.
cyw43_arch_disable_sta_mode
void cyw43_arch_disable_sta_mode (void)
Disables Wi-Fi STA (Station) mode.
This disables the Wi-Fi in Station mode, disconnecting any active connection. You should subsequently check the status by calling cyw43_wifi_link_status.
cyw43_arch_enable_ap_mode
void cyw43_arch_enable_ap_mode (const char * ssid, const char * password, uint32_t auth)
Enables Wi-Fi AP (Access point) mode.
This enables the Wi-Fi in Access Point mode such that connections can be made to the device by other Wi-Fi clients
Parameters
ssid
|
the name for the access point |
password
|
the password to use or NULL for no password. |
auth
|
the authorization type to use when the password is enabled. Values are CYW43_AUTH_WPA_TKIP_PSK, CYW43_AUTH_WPA2_AES_PSK, or CYW43_AUTH_WPA2_MIXED_PSK (see CYW43_AUTH_) |
cyw43_arch_enable_sta_mode
void cyw43_arch_enable_sta_mode (void)
Enables Wi-Fi STA (Station) mode.
This enables the Wi-Fi in Station mode such that connections can be made to other Wi-Fi Access Points
cyw43_arch_get_country_code
uint32_t cyw43_arch_get_country_code (void)
Return the country code used to initialize cyw43_arch.
Returns
the country code (see CYW43_COUNTRY_)
cyw43_arch_gpio_get
bool cyw43_arch_gpio_get (uint wl_gpio)
Read the value of a GPIO pin on the wireless chip.
|
Note
|
this method does not check for errors setting the GPIO. You can use the lower level cyw43_gpio_get instead if you wish to check for errors. |
Parameters
wl_gpio
|
the GPIO number on the wireless chip |
Returns
true if the GPIO is high, false otherwise
cyw43_arch_gpio_put
void cyw43_arch_gpio_put (uint wl_gpio, bool value)
Set a GPIO pin on the wireless chip to a given value.
|
Note
|
this method does not check for errors setting the GPIO. You can use the lower level cyw43_gpio_set instead if you wish to check for errors. |
Parameters
wl_gpio
|
the GPIO number on the wireless chip |
value
|
true to set the GPIO, false to clear it. |
cyw43_arch_init
int cyw43_arch_init (void)
Initialize the CYW43 architecture.
This method initializes the cyw43_driver code and initializes the lwIP stack (if it was enabled at build time). This method must be called prior to using any other pico_cyw43_arch, cyw43_driver or lwIP functions.
|
Note
|
this method initializes wireless with a country code of |
By default this method initializes the cyw43_arch code’s own async_context by calling cyw43_arch_init_default_async_context, however the user can specify use of their own async_context by calling cyw43_arch_set_async_context() before calling this method
Returns
0 if the initialization is successful, an error code otherwise see pico_error_codes
cyw43_arch_init_default_async_context
async_context_t * cyw43_arch_init_default_async_context (void)
Initialize the default async_context for the current cyw43_arch type.
This method initializes and returns a pointer to the static async_context associated with cyw43_arch. This method is called by cyw43_arch_init automatically if a different async_context has not been set by cyw43_arch_set_async_context
Returns
the context or NULL if initialization failed.
cyw43_arch_init_with_country
int cyw43_arch_init_with_country (uint32_t country)
Initialize the CYW43 architecture for use in a specific country.
This method initializes the cyw43_driver code and initializes the lwIP stack (if it was enabled at build time). This method must be called prior to using any other pico_cyw43_arch, cyw43_driver or lwIP functions.
By default this method initializes the cyw43_arch code’s own async_context by calling cyw43_arch_init_default_async_context, however the user can specify use of their own async_context by calling cyw43_arch_set_async_context() before calling this method
Parameters
country
|
the country code to use (see CYW43_COUNTRY_) |
Returns
0 if the initialization is successful, an error code otherwise see pico_error_codes
cyw43_arch_poll
void cyw43_arch_poll (void)
Perform any processing required by the cyw43_driver or the TCP/IP stack.
This method must be called periodically from the main loop when using a polling style pico_cyw43_arch (e.g. pico_cyw43_arch_lwip_poll ). It may be called in other styles, but it is unnecessary to do so.
cyw43_arch_set_async_context
void cyw43_arch_set_async_context (async_context_t * context)
Set the async_context to be used by the cyw43_arch_init.
|
Note
|
This method must be called before calling cyw43_arch_init or cyw43_arch_init_with_country if you wish to use a custom async_context instance. |
Parameters
context
|
the async_context to be used |
cyw43_arch_wait_for_work_until
void cyw43_arch_wait_for_work_until (absolute_time_t until)
Sleep until there is cyw43_driver work to be done.
This method may be called by code that is waiting for an event to come from the cyw43_driver, and has no work to do, but would like to sleep without blocking any background work associated with the cyw43_driver.
Parameters
until
|
the time to wait until if there is no work to do. |
cyw43_arch_wifi_connect_async
int cyw43_arch_wifi_connect_async (const char * ssid, const char * pw, uint32_t auth)
Start attempting to connect to a wireless access point.
This method tells the CYW43 driver to start connecting to an access point. You should subsequently check the status by calling cyw43_wifi_link_status.
Parameters
ssid
|
the network name to connect to |
pw
|
the network password or NULL if there is no password required |
auth
|
the authorization type to use when the password is enabled. Values are CYW43_AUTH_WPA_TKIP_PSK, CYW43_AUTH_WPA2_AES_PSK, or CYW43_AUTH_WPA2_MIXED_PSK (see CYW43_AUTH_) |
Returns
0 if the scan was started successfully, an error code otherwise see pico_error_codes
cyw43_arch_wifi_connect_blocking
int cyw43_arch_wifi_connect_blocking (const char * ssid, const char * pw, uint32_t auth)
Attempt to connect to a wireless access point, blocking until the network is joined or a failure is detected.
Parameters
ssid
|
the network name to connect to |
pw
|
the network password or NULL if there is no password required |
auth
|
the authorization type to use when the password is enabled. Values are CYW43_AUTH_WPA_TKIP_PSK, CYW43_AUTH_WPA2_AES_PSK, or CYW43_AUTH_WPA2_MIXED_PSK (see CYW43_AUTH_) |
Returns
0 if the connection is successful. PICO_ERROR_BADAUTH is returned if the WiFi password is wrong. PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
cyw43_arch_wifi_connect_bssid_async
int cyw43_arch_wifi_connect_bssid_async (const char * ssid, const uint8_t * bssid, const char * pw, uint32_t auth)
Start attempting to connect to a wireless access point specified by SSID and BSSID.
This method tells the CYW43 driver to start connecting to an access point. You should subsequently check the status by calling cyw43_wifi_link_status.
Parameters
ssid
|
the network name to connect to |
bssid
|
the network BSSID to connect to or NULL if ignored |
pw
|
the network password or NULL if there is no password required |
auth
|
the authorization type to use when the password is enabled. Values are CYW43_AUTH_WPA_TKIP_PSK, CYW43_AUTH_WPA2_AES_PSK, or CYW43_AUTH_WPA2_MIXED_PSK (see CYW43_AUTH_) |
Returns
0 if the scan was started successfully, an error code otherwise see pico_error_codes
cyw43_arch_wifi_connect_bssid_blocking
int cyw43_arch_wifi_connect_bssid_blocking (const char * ssid, const uint8_t * bssid, const char * pw, uint32_t auth)
Attempt to connect to a wireless access point specified by SSID and BSSID, blocking until the network is joined or a failure is detected.
Parameters
ssid
|
the network name to connect to |
bssid
|
the network BSSID to connect to or NULL if ignored |
pw
|
the network password or NULL if there is no password required |
auth
|
the authorization type to use when the password is enabled. Values are CYW43_AUTH_WPA_TKIP_PSK, CYW43_AUTH_WPA2_AES_PSK, or CYW43_AUTH_WPA2_MIXED_PSK (see CYW43_AUTH_) |
Returns
0 if the connection is successful. PICO_ERROR_BADAUTH is returned if the WiFi password is wrong. PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
cyw43_arch_wifi_connect_bssid_timeout_ms
int cyw43_arch_wifi_connect_bssid_timeout_ms (const char * ssid, const uint8_t * bssid, const char * pw, uint32_t auth, uint32_t timeout)
Attempt to connect to a wireless access point specified by SSID and BSSID, blocking until the network is joined, a failure is detected or a timeout occurs.
Parameters
ssid
|
the network name to connect to |
bssid
|
the network BSSID to connect to or NULL if ignored |
pw
|
the network password or NULL if there is no password required |
auth
|
the authorization type to use when the password is enabled. Values are CYW43_AUTH_WPA_TKIP_PSK, CYW43_AUTH_WPA2_AES_PSK, or CYW43_AUTH_WPA2_MIXED_PSK (see CYW43_AUTH_) |
timeout
|
how long to wait in milliseconds for a connection to succeed before giving up |
Returns
0 if the connection is successful. PICO_ERROR_TIMEOUT is returned if the timeout is reached before a successful connection. PICO_ERROR_BADAUTH is returned if the WiFi password is wrong. PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
cyw43_arch_wifi_connect_timeout_ms
int cyw43_arch_wifi_connect_timeout_ms (const char * ssid, const char * pw, uint32_t auth, uint32_t timeout)
Attempt to connect to a wireless access point, blocking until the network is joined, a failure is detected or a timeout occurs.
Parameters
ssid
|
the network name to connect to |
pw
|
the network password or NULL if there is no password required |
auth
|
the authorization type to use when the password is enabled. Values are CYW43_AUTH_WPA_TKIP_PSK, CYW43_AUTH_WPA2_AES_PSK, or CYW43_AUTH_WPA2_MIXED_PSK (see CYW43_AUTH_) |
timeout
|
how long to wait in milliseconds for a connection to succeed before giving up |
Returns
0 if the connection is successful. PICO_ERROR_TIMEOUT is returned if the timeout is reached before a successful connection. PICO_ERROR_BADAUTH is returned if the WiFi password is wrong. PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
cyw43_driver
Driver used for Pico W wireless.
Modules
- cyw43_ll
-
Low Level CYW43 driver interface.
Macros
-
#define CYW43_DEFAULT_PM (CYW43_PERFORMANCE_PM) -
#define CYW43_NONE_PM (cyw43_pm_value(CYW43_NO_POWERSAVE_MODE, 10, 0, 0, 0)) -
#define CYW43_AGGRESSIVE_PM (cyw43_pm_value(CYW43_PM1_POWERSAVE_MODE, 10, 0, 0, 0)) -
#define CYW43_PERFORMANCE_PM (cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 200, 1, 1, 10)) -
#define CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
Functions
void cyw43_init (cyw43_t *self)-
Initialize the driver.
void cyw43_deinit (cyw43_t *self)-
Shut the driver down.
int cyw43_ioctl (cyw43_t *self, uint32_t cmd, size_t len, uint8_t *buf, uint32_t iface)-
Send an ioctl command to cyw43.
int cyw43_send_ethernet (cyw43_t *self, int itf, size_t len, const void *buf, bool is_pbuf)-
Send a raw ethernet packet.
int cyw43_wifi_pm (cyw43_t *self, uint32_t pm)-
Set the wifi power management mode.
int cyw43_wifi_get_pm (cyw43_t *self, uint32_t *pm)-
Get the wifi power management mode.
int cyw43_wifi_link_status (cyw43_t *self, int itf)-
Get the wifi link status.
void cyw43_wifi_set_up (cyw43_t *self, int itf, bool up, uint32_t country)-
Set up and initialise wifi.
int cyw43_wifi_get_mac (cyw43_t *self, int itf, uint8_t mac[6])-
Get the mac address of the device.
int cyw43_wifi_update_multicast_filter (cyw43_t *self, uint8_t *addr, bool add)-
Add/remove multicast group address.
int cyw43_wifi_scan (cyw43_t *self, cyw43_wifi_scan_options_t *opts, void *env, int(*result_cb)(void *, const cyw43_ev_scan_result_t *))-
Perform a wifi scan for wifi networks.
static bool cyw43_wifi_scan_active (cyw43_t *self)-
Determine if a wifi scan is in progress.
int cyw43_wifi_join (cyw43_t *self, size_t ssid_len, const uint8_t *ssid, size_t key_len, const uint8_t *key, uint32_t auth_type, const uint8_t *bssid, uint32_t channel)-
Connect or join a wifi network.
int cyw43_wifi_leave (cyw43_t *self, int itf)-
Disassociate from a wifi network.
int cyw43_wifi_get_rssi (cyw43_t *self, int32_t *rssi)-
Get the signal strength (RSSI) of the wifi network.
int cyw43_wifi_get_bssid (cyw43_t *self, uint8_t bssid[6])-
Get the BSSID of the connected wifi network.
static void cyw43_wifi_ap_get_ssid (cyw43_t *self, size_t *len, const uint8_t **buf)-
Get the ssid for the access point.
static uint32_t cyw43_wifi_ap_get_auth (cyw43_t *self)-
Get the security authorisation used in AP mode.
static void cyw43_wifi_ap_set_channel (cyw43_t *self, uint32_t channel)-
Set the the channel for the access point.
static void cyw43_wifi_ap_set_ssid (cyw43_t *self, size_t len, const uint8_t *buf)-
Set the ssid for the access point.
static void cyw43_wifi_ap_set_password (cyw43_t *self, size_t len, const uint8_t *buf)-
Set the password for the wifi access point.
static void cyw43_wifi_ap_set_auth (cyw43_t *self, uint32_t auth)-
Set the security authorisation used in AP mode.
void cyw43_wifi_ap_get_max_stas (cyw43_t *self, int *max_stas)-
Get the maximum number of devices (STAs) that can be associated with the wifi access point.
void cyw43_wifi_ap_get_stas (cyw43_t *self, int *num_stas, uint8_t *macs)-
Get the number of devices (STAs) associated with the wifi access point.
static bool cyw43_is_initialized (cyw43_t *self)-
Determines if the cyw43 driver been initialised.
void cyw43_cb_tcpip_init (cyw43_t *self, int itf)-
Initialise the IP stack.
void cyw43_cb_tcpip_deinit (cyw43_t *self, int itf)-
Deinitialise the IP stack.
void cyw43_cb_tcpip_set_link_up (cyw43_t *self, int itf)-
Notify the IP stack that the link is up.
void cyw43_cb_tcpip_set_link_down (cyw43_t *self, int itf)-
Notify the IP stack that the link is down.
int cyw43_tcpip_link_status (cyw43_t *self, int itf)-
Get the link status.
static uint32_t cyw43_pm_value (uint8_t pm_mode, uint16_t pm2_sleep_ret_ms, uint8_t li_beacon_period, uint8_t li_dtim_period, uint8_t li_assoc)-
Return a power management value to pass to cyw43_wifi_pm.
Variables
cyw43_t cyw43_statevoid(* cyw43_poll)(void)uint32_t cyw43_sleep
CYW43 driver version as components
CYW43_VERSION_MAJOR
#define CYW43_VERSION_MAJOR 1
CYW43_VERSION_MINOR
#define CYW43_VERSION_MINOR 1
CYW43_VERSION_MICRO
#define CYW43_VERSION_MICRO 0
CYW43 driver version
Combined CYW43 driver version as a 32-bit number
CYW43_VERSION
#define CYW43_VERSION (CYW43_VERSION_MAJOR << 16 | CYW43_VERSION_MINOR << 8 | CYW43_VERSION_MICRO)
Trace flags
CYW43_TRACE_ASYNC_EV
#define CYW43_TRACE_ASYNC_EV (0x0001)
CYW43_TRACE_ETH_TX
#define CYW43_TRACE_ETH_TX (0x0002)
CYW43_TRACE_ETH_RX
#define CYW43_TRACE_ETH_RX (0x0004)
CYW43_TRACE_ETH_FULL
#define CYW43_TRACE_ETH_FULL (0x0008)
CYW43_TRACE_MAC
#define CYW43_TRACE_MAC (0x0010)
Link status
See also
status_name() to get a user readable name of the status for debug
cyw43_wifi_link_status() to get the wifi status
cyw43_tcpip_link_status() to get the overall link status
CYW43_LINK_DOWN
#define CYW43_LINK_DOWN (0)
link is down
CYW43_LINK_JOIN
#define CYW43_LINK_JOIN (1)
Connected to wifi.
CYW43_LINK_NOIP
#define CYW43_LINK_NOIP (2)
Connected to wifi, but no IP address.
CYW43_LINK_UP
#define CYW43_LINK_UP (3)
Connected to wifi with an IP address.
CYW43_LINK_FAIL
#define CYW43_LINK_FAIL (-1)
Connection failed.
CYW43_LINK_NONET
#define CYW43_LINK_NONET (-2)
No matching SSID found (could be out of range, or down)
CYW43_LINK_BADAUTH
#define CYW43_LINK_BADAUTH (-3)
Authenticatation failure
Country codes
CYW43_COUNTRY_WORLDWIDE
#define CYW43_COUNTRY_WORLDWIDE CYW43_COUNTRY('X', 'X', 0)
CYW43_COUNTRY_AUSTRALIA
#define CYW43_COUNTRY_AUSTRALIA CYW43_COUNTRY('A', 'U', 0)
CYW43_COUNTRY_AUSTRIA
#define CYW43_COUNTRY_AUSTRIA CYW43_COUNTRY('A', 'T', 0)
CYW43_COUNTRY_BELGIUM
#define CYW43_COUNTRY_BELGIUM CYW43_COUNTRY('B', 'E', 0)
CYW43_COUNTRY_BRAZIL
#define CYW43_COUNTRY_BRAZIL CYW43_COUNTRY('B', 'R', 0)
CYW43_COUNTRY_CANADA
#define CYW43_COUNTRY_CANADA CYW43_COUNTRY('C', 'A', 0)
CYW43_COUNTRY_CHILE
#define CYW43_COUNTRY_CHILE CYW43_COUNTRY('C', 'L', 0)
CYW43_COUNTRY_CHINA
#define CYW43_COUNTRY_CHINA CYW43_COUNTRY('C', 'N', 0)
CYW43_COUNTRY_COLOMBIA
#define CYW43_COUNTRY_COLOMBIA CYW43_COUNTRY('C', 'O', 0)
CYW43_COUNTRY_CZECH_REPUBLIC
#define CYW43_COUNTRY_CZECH_REPUBLIC CYW43_COUNTRY('C', 'Z', 0)
CYW43_COUNTRY_DENMARK
#define CYW43_COUNTRY_DENMARK CYW43_COUNTRY('D', 'K', 0)
CYW43_COUNTRY_ESTONIA
#define CYW43_COUNTRY_ESTONIA CYW43_COUNTRY('E', 'E', 0)
CYW43_COUNTRY_FINLAND
#define CYW43_COUNTRY_FINLAND CYW43_COUNTRY('F', 'I', 0)
CYW43_COUNTRY_FRANCE
#define CYW43_COUNTRY_FRANCE CYW43_COUNTRY('F', 'R', 0)
CYW43_COUNTRY_GERMANY
#define CYW43_COUNTRY_GERMANY CYW43_COUNTRY('D', 'E', 0)
CYW43_COUNTRY_GREECE
#define CYW43_COUNTRY_GREECE CYW43_COUNTRY('G', 'R', 0)
CYW43_COUNTRY_HONG_KONG
#define CYW43_COUNTRY_HONG_KONG CYW43_COUNTRY('H', 'K', 0)
CYW43_COUNTRY_HUNGARY
#define CYW43_COUNTRY_HUNGARY CYW43_COUNTRY('H', 'U', 0)
CYW43_COUNTRY_ICELAND
#define CYW43_COUNTRY_ICELAND CYW43_COUNTRY('I', 'S', 0)
CYW43_COUNTRY_INDIA
#define CYW43_COUNTRY_INDIA CYW43_COUNTRY('I', 'N', 0)
CYW43_COUNTRY_ISRAEL
#define CYW43_COUNTRY_ISRAEL CYW43_COUNTRY('I', 'L', 0)
CYW43_COUNTRY_ITALY
#define CYW43_COUNTRY_ITALY CYW43_COUNTRY('I', 'T', 0)
CYW43_COUNTRY_JAPAN
#define CYW43_COUNTRY_JAPAN CYW43_COUNTRY('J', 'P', 0)
CYW43_COUNTRY_KENYA
#define CYW43_COUNTRY_KENYA CYW43_COUNTRY('K', 'E', 0)
CYW43_COUNTRY_LATVIA
#define CYW43_COUNTRY_LATVIA CYW43_COUNTRY('L', 'V', 0)
CYW43_COUNTRY_LIECHTENSTEIN
#define CYW43_COUNTRY_LIECHTENSTEIN CYW43_COUNTRY('L', 'I', 0)
CYW43_COUNTRY_LITHUANIA
#define CYW43_COUNTRY_LITHUANIA CYW43_COUNTRY('L', 'T', 0)
CYW43_COUNTRY_LUXEMBOURG
#define CYW43_COUNTRY_LUXEMBOURG CYW43_COUNTRY('L', 'U', 0)
CYW43_COUNTRY_MALAYSIA
#define CYW43_COUNTRY_MALAYSIA CYW43_COUNTRY('M', 'Y', 0)
CYW43_COUNTRY_MALTA
#define CYW43_COUNTRY_MALTA CYW43_COUNTRY('M', 'T', 0)
CYW43_COUNTRY_MEXICO
#define CYW43_COUNTRY_MEXICO CYW43_COUNTRY('M', 'X', 0)
CYW43_COUNTRY_NETHERLANDS
#define CYW43_COUNTRY_NETHERLANDS CYW43_COUNTRY('N', 'L', 0)
CYW43_COUNTRY_NEW_ZEALAND
#define CYW43_COUNTRY_NEW_ZEALAND CYW43_COUNTRY('N', 'Z', 0)
CYW43_COUNTRY_NIGERIA
#define CYW43_COUNTRY_NIGERIA CYW43_COUNTRY('N', 'G', 0)
CYW43_COUNTRY_NORWAY
#define CYW43_COUNTRY_NORWAY CYW43_COUNTRY('N', 'O', 0)
CYW43_COUNTRY_PERU
#define CYW43_COUNTRY_PERU CYW43_COUNTRY('P', 'E', 0)
CYW43_COUNTRY_PHILIPPINES
#define CYW43_COUNTRY_PHILIPPINES CYW43_COUNTRY('P', 'H', 0)
CYW43_COUNTRY_POLAND
#define CYW43_COUNTRY_POLAND CYW43_COUNTRY('P', 'L', 0)
CYW43_COUNTRY_PORTUGAL
#define CYW43_COUNTRY_PORTUGAL CYW43_COUNTRY('P', 'T', 0)
CYW43_COUNTRY_SINGAPORE
#define CYW43_COUNTRY_SINGAPORE CYW43_COUNTRY('S', 'G', 0)
CYW43_COUNTRY_SLOVAKIA
#define CYW43_COUNTRY_SLOVAKIA CYW43_COUNTRY('S', 'K', 0)
CYW43_COUNTRY_SLOVENIA
#define CYW43_COUNTRY_SLOVENIA CYW43_COUNTRY('S', 'I', 0)
CYW43_COUNTRY_SOUTH_AFRICA
#define CYW43_COUNTRY_SOUTH_AFRICA CYW43_COUNTRY('Z', 'A', 0)
CYW43_COUNTRY_SOUTH_KOREA
#define CYW43_COUNTRY_SOUTH_KOREA CYW43_COUNTRY('K', 'R', 0)
CYW43_COUNTRY_SPAIN
#define CYW43_COUNTRY_SPAIN CYW43_COUNTRY('E', 'S', 0)
CYW43_COUNTRY_SWEDEN
#define CYW43_COUNTRY_SWEDEN CYW43_COUNTRY('S', 'E', 0)
CYW43_COUNTRY_SWITZERLAND
#define CYW43_COUNTRY_SWITZERLAND CYW43_COUNTRY('C', 'H', 0)
CYW43_COUNTRY_TAIWAN
#define CYW43_COUNTRY_TAIWAN CYW43_COUNTRY('T', 'W', 0)
CYW43_COUNTRY_THAILAND
#define CYW43_COUNTRY_THAILAND CYW43_COUNTRY('T', 'H', 0)
CYW43_COUNTRY_TURKEY
#define CYW43_COUNTRY_TURKEY CYW43_COUNTRY('T', 'R', 0)
CYW43_COUNTRY_UK
#define CYW43_COUNTRY_UK CYW43_COUNTRY('G', 'B', 0)
CYW43_COUNTRY_USA
#define CYW43_COUNTRY_USA CYW43_COUNTRY('U', 'S', 0)
Macro Definition Documentation
CYW43_DEFAULT_PM
#define CYW43_DEFAULT_PM (CYW43_PERFORMANCE_PM)
Default power management mode.
CYW43_NONE_PM
#define CYW43_NONE_PM (cyw43_pm_value(CYW43_NO_POWERSAVE_MODE, 10, 0, 0, 0))
No power management.
CYW43_AGGRESSIVE_PM
#define CYW43_AGGRESSIVE_PM (cyw43_pm_value(CYW43_PM1_POWERSAVE_MODE, 10, 0, 0, 0))
Aggressive power management mode for optimal power usage at the cost of performance.
CYW43_PERFORMANCE_PM
#define CYW43_PERFORMANCE_PM (cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 200, 1, 1, 10))
Performance power management mode where more power is used to increase performance.
CYW43_COUNTRY
#define CYW43_COUNTRY(A, B, REV) ((unsigned char)(A) | ((unsigned char)(B) << 8) | ((REV) << 16))
create a country code from the two character country and revision number
Function Documentation
cyw43_cb_tcpip_deinit
void cyw43_cb_tcpip_deinit (cyw43_t * self, int itf)
Deinitialise the IP stack.
This method must be provided by the network stack interface It is called to close the IP stack and free resources.
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface used, either CYW43_ITF_STA or CYW43_ITF_AP |
cyw43_cb_tcpip_init
void cyw43_cb_tcpip_init (cyw43_t * self, int itf)
Initialise the IP stack.
This method must be provided by the network stack interface It is called to initialise the IP stack.
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface used, either CYW43_ITF_STA or CYW43_ITF_AP |
cyw43_cb_tcpip_set_link_down
void cyw43_cb_tcpip_set_link_down (cyw43_t * self, int itf)
Notify the IP stack that the link is down.
This method must be provided by the network stack interface It is called to notify the IP stack that the link is down.
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface used, either CYW43_ITF_STA or CYW43_ITF_AP |
cyw43_cb_tcpip_set_link_up
void cyw43_cb_tcpip_set_link_up (cyw43_t * self, int itf)
Notify the IP stack that the link is up.
This method must be provided by the network stack interface It is called to notify the IP stack that the link is up. This can, for example be used to request an IP address via DHCP.
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface used, either CYW43_ITF_STA or CYW43_ITF_AP |
cyw43_deinit
void cyw43_deinit (cyw43_t * self)
Shut the driver down.
This method will close the network interfaces, and free up resources
Parameters
self
|
the driver state object. This should always be |
cyw43_init
void cyw43_init (cyw43_t * self)
Initialize the driver.
This method must be called before using the driver
Parameters
self
|
the driver state object. This should always be |
cyw43_ioctl
int cyw43_ioctl (cyw43_t * self, uint32_t cmd, size_t len, uint8_t * buf, uint32_t iface)
Send an ioctl command to cyw43.
This method sends a command to cyw43.
Parameters
self
|
the driver state object. This should always be |
cmd
|
the command to send |
len
|
the amount of data to send with the command |
buf
|
a buffer containing the data to send |
iface
|
the interface to use, either CYW43_ITF_STA or CYW43_ITF_AP |
Returns
0 on success
cyw43_is_initialized
static bool cyw43_is_initialized (cyw43_t * self) [inline], [static]
Determines if the cyw43 driver been initialised.
Returns true if the cyw43 driver has been initialised with a call to cyw43_init
Parameters
self
|
the driver state object. This should always be |
Returns
True if the cyw43 driver has been initialised
cyw43_pm_value
static uint32_t cyw43_pm_value (uint8_t pm_mode, uint16_t pm2_sleep_ret_ms, uint8_t li_beacon_period, uint8_t li_dtim_period, uint8_t li_assoc) [inline], [static]
Return a power management value to pass to cyw43_wifi_pm.
Generate the power management (PM) value to pass to cyw43_wifi_pm
| pm_mode | Meaning |
|---|---|
CYW43_NO_POWERSAVE_MODE |
No power saving |
CYW43_PM1_POWERSAVE_MODE |
Aggressive power saving which reduces wifi throughput |
CYW43_PM2_POWERSAVE_MODE |
Power saving with High throughput (preferred). Saves power when there is no wifi activity for some time. |
Parameters
pm_mode
|
Power management mode |
pm2_sleep_ret_ms
|
The maximum time to wait before going back to sleep for CYW43_PM2_POWERSAVE_MODE mode. Value measured in milliseconds and must be between 10 and 2000ms and divisible by 10 |
li_beacon_period
|
Wake period is measured in beacon periods |
li_dtim_period
|
Wake interval measured in DTIMs. If this is set to 0, the wake interval is measured in beacon periods |
li_assoc
|
Wake interval sent to the access point |
cyw43_send_ethernet
int cyw43_send_ethernet (cyw43_t * self, int itf, size_t len, const void * buf, bool is_pbuf)
Send a raw ethernet packet.
This method sends a raw ethernet packet.
Parameters
self
|
the driver state object. This should always be |
itf
|
interface to use, either CYW43_ITF_STA or CYW43_ITF_AP |
len
|
the amount of data to send |
buf
|
the data to send |
is_pbuf
|
true if buf points to an lwip struct pbuf |
Returns
0 on success
cyw43_tcpip_link_status
int cyw43_tcpip_link_status (cyw43_t * self, int itf)
Get the link status.
Returns the status of the link which is a superset of the wifi link status returned by cyw43_wifi_link_status
|
Note
|
If the link status is negative it indicates an error |
| link status | Meaning |
|---|---|
CYW43_LINK_DOWN |
Wifi down |
CYW43_LINK_JOIN |
Connected to wifi |
CYW43_LINK_NOIP |
Connected to wifi, but no IP address |
CYW43_LINK_UP |
Connect to wifi with an IP address |
CYW43_LINK_FAIL |
Connection failed |
CYW43_LINK_NONET |
No matching SSID found (could be out of range, or down) |
CYW43_LINK_BADAUTH |
Authenticatation failure |
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface for which to return the link status, should be CYW43_ITF_STA or CYW43_ITF_AP |
Returns
A value representing the link status
cyw43_wifi_ap_get_auth
static uint32_t cyw43_wifi_ap_get_auth (cyw43_t * self) [inline], [static]
Get the security authorisation used in AP mode.
For access point (AP) mode, this method can be used to get the security authorisation mode.
Parameters
self
|
the driver state object. This should always be |
Returns
the current security authorisation mode for the access point
cyw43_wifi_ap_get_max_stas
void cyw43_wifi_ap_get_max_stas (cyw43_t * self, int * max_stas)
Get the maximum number of devices (STAs) that can be associated with the wifi access point.
For access point (AP) mode, this method can be used to get the maximum number of devices that can be connected to the wifi access point.
Parameters
self
|
the driver state object. This should always be |
max_stas
|
Returns the maximum number of devices (STAs) that can be connected to the access point (set to 0 on error) |
cyw43_wifi_ap_get_ssid
static void cyw43_wifi_ap_get_ssid (cyw43_t * self, size_t * len, const uint8_t ** buf) [inline], [static]
Get the ssid for the access point.
For access point (AP) mode, this method can be used to get the SSID name of the wifi access point.
Parameters
self
|
the driver state object. This should always be |
len
|
Returns the length of the AP SSID name |
buf
|
Returns a pointer to an internal buffer containing the AP SSID name |
cyw43_wifi_ap_get_stas
void cyw43_wifi_ap_get_stas (cyw43_t * self, int * num_stas, uint8_t * macs)
Get the number of devices (STAs) associated with the wifi access point.
For access point (AP) mode, this method can be used to get the number of devices and mac addresses of devices connected to the wifi access point.
Parameters
self
|
the driver state object. This should always be |
num_stas
|
Caller must provide the number of MACs that will fit in the macs buffer; The supplied buffer should have enough room for 6 bytes per MAC address. Returns the number of devices (STA) connected to the access point. |
macs
|
Returns up to num_stas MAC addresses of devices (STA) connected to the access point. Call cyw43_wifi_ap_get_max_stas to determine how many mac addresses can be returned. |
cyw43_wifi_ap_set_auth
static void cyw43_wifi_ap_set_auth (cyw43_t * self, uint32_t auth) [inline], [static]
Set the security authorisation used in AP mode.
For access point (AP) mode, this method can be used to set how access to the access point is authorised.
| Auth mode | Meaning |
|---|---|
CYW43_AUTH_OPEN |
Use an open access point with no authorisation required |
CYW43_AUTH_WPA_TKIP_PSK |
Use WPA authorisation |
CYW43_AUTH_WPA2_AES_PSK |
Use WPA2 (preferred) |
CYW43_AUTH_WPA2_MIXED_PSK |
Use WPA2/WPA mixed (currently treated the same as CYW43_AUTH_WPA2_AES_PSK) |
Parameters
self
|
the driver state object. This should always be |
auth
|
Auth mode for the access point |
cyw43_wifi_ap_set_channel
static void cyw43_wifi_ap_set_channel (cyw43_t * self, uint32_t channel) [inline], [static]
Set the the channel for the access point.
For access point (AP) mode, this method can be used to set the channel used for the wifi access point.
Parameters
self
|
the driver state object. This should always be |
channel
|
Wifi channel to use for the wifi access point |
cyw43_wifi_ap_set_password
static void cyw43_wifi_ap_set_password (cyw43_t * self, size_t len, const uint8_t * buf) [inline], [static]
Set the password for the wifi access point.
For access point (AP) mode, this method can be used to set the password for the wifi access point.
Parameters
self
|
the driver state object. This should always be |
len
|
The length of the AP password |
buf
|
A buffer containing the AP password |
cyw43_wifi_ap_set_ssid
static void cyw43_wifi_ap_set_ssid (cyw43_t * self, size_t len, const uint8_t * buf) [inline], [static]
Set the ssid for the access point.
For access point (AP) mode, this method can be used to set the SSID name of the wifi access point.
Parameters
self
|
the driver state object. This should always be |
len
|
The length of the AP SSID name |
buf
|
A buffer containing the AP SSID name |
cyw43_wifi_get_bssid
int cyw43_wifi_get_bssid (cyw43_t * self, uint8_t bssid)
Get the BSSID of the connected wifi network.
Parameters
self
|
the driver state object. This should always be |
bssid
|
a buffer to receive the BSSID |
Returns
0 on success
cyw43_wifi_get_mac
int cyw43_wifi_get_mac (cyw43_t * self, int itf, uint8_t mac)
Get the mac address of the device.
This method returns the mac address of the interface.
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface to use, either CYW43_ITF_STA or CYW43_ITF_AP |
mac
|
a buffer to receive the mac address |
Returns
0 on success
cyw43_wifi_get_pm
int cyw43_wifi_get_pm (cyw43_t * self, uint32_t * pm)
Get the wifi power management mode.
This method gets the power management mode used by cyw43. The value is expressed as an unsigned integer 0x00adbrrm where, m = pm_mode Power management mode rr = pm2_sleep_ret (in units of 10ms) b = li_beacon_period d = li_dtim_period a = li_assoc
See also
cyw43_pm_value for an explanation of these values This should be called after cyw43_wifi_set_up
Parameters
self
|
the driver state object. This should always be |
pm
|
Power management value |
Returns
0 on success
cyw43_wifi_get_rssi
int cyw43_wifi_get_rssi (cyw43_t * self, int32_t * rssi)
Get the signal strength (RSSI) of the wifi network.
For STA (client) mode, returns the signal strength or RSSI of the wifi network. An RSSI value of zero is returned if you call this function before a network is connected.
Parameters
self
|
the driver state object. This should always be |
rssi
|
a pointer to which the returned RSSI value is stored. |
Returns
0 on success
cyw43_wifi_join
int cyw43_wifi_join (cyw43_t * self, size_t ssid_len, const uint8_t * ssid, size_t key_len, const uint8_t * key, uint32_t auth_type, const uint8_t * bssid, uint32_t channel)
Connect or join a wifi network.
Connect to a wifi network in STA (client) mode After success is returned, periodically call cyw43_wifi_link_status or cyw43_tcpip_link_status, to query the status of the link. It can take a many seconds to connect to fully join a network.
|
Note
|
Call cyw43_wifi_leave to disassociate from a wifi network. |
Parameters
self
|
the driver state object. This should always be |
ssid_len
|
the length of the wifi network name |
ssid
|
A buffer containing the wifi network name |
key_len
|
The length of the wifi password |
key
|
A buffer containing the wifi password |
auth_type
|
Auth type, |
See also
CYW43_AUTH_
Parameters
bssid
|
the mac address of the access point to connect to. This can be NULL. |
channel
|
Used to set the band of the connection. This is only used if bssid is non NULL. |
Returns
0 on success
cyw43_wifi_leave
int cyw43_wifi_leave (cyw43_t * self, int itf)
Disassociate from a wifi network.
This method disassociates from a wifi network.
Parameters
self
|
the driver state object. This should always be |
itf
|
The interface to disconnect, either CYW43_ITF_STA or CYW43_ITF_AP |
Returns
0 on success
cyw43_wifi_link_status
int cyw43_wifi_link_status (cyw43_t * self, int itf)
Get the wifi link status.
Returns the status of the wifi link.
| link status | Meaning |
|---|---|
CYW43_LINK_DOWN |
Wifi down |
CYW43_LINK_JOIN |
Connected to wifi |
CYW43_LINK_FAIL |
Connection failed |
CYW43_LINK_NONET |
No matching SSID found (could be out of range, or down) |
CYW43_LINK_BADAUTH |
Authenticatation failure |
|
Note
|
If the link status is negative it indicates an error The wifi link status for the interface CYW43_ITF_AP is always CYW43_LINK_DOWN |
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface to use, should be CYW43_ITF_STA or CYW43_ITF_AP |
Returns
A integer value representing the link status
cyw43_wifi_pm
int cyw43_wifi_pm (cyw43_t * self, uint32_t pm)
Set the wifi power management mode.
This method sets the power management mode used by cyw43. This should be called after cyw43_wifi_set_up
Parameters
self
|
the driver state object. This should always be |
pm
|
Power management value |
Returns
0 on success
cyw43_wifi_scan
int cyw43_wifi_scan (cyw43_t * self, cyw43_wifi_scan_options_t * opts, void * env, int(*)(void *, const cyw43_ev_scan_result_t *) result_cb)
Perform a wifi scan for wifi networks.
Start a scan for wifi networks. Results are returned via the callback.
|
Note
|
The scan is complete when cyw43_wifi_scan_active return false |
Parameters
self
|
the driver state object. This should always be |
opts
|
An instance of cyw43_wifi_scan_options_t. Values in here are currently ignored. |
env
|
Pointer passed back in the callback |
result_cb
|
Callback for wifi scan results, see cyw43_ev_scan_result_t |
Returns
0 on success
cyw43_wifi_scan_active
static bool cyw43_wifi_scan_active (cyw43_t * self) [inline], [static]
Determine if a wifi scan is in progress.
This method tells you if the scan is still in progress
Parameters
self
|
the driver state object. This should always be |
Returns
true if a wifi scan is in progress
cyw43_wifi_set_up
void cyw43_wifi_set_up (cyw43_t * self, int itf, bool up, uint32_t country)
Set up and initialise wifi.
This method turns on wifi and sets the country for regulation purposes. The power management mode is initialised to CYW43_DEFAULT_PM For CYW43_ITF_AP, the access point is enabled. For CYW43_ITF_STA, the TCP/IP stack is reinitialised
Parameters
self
|
the driver state object. This should always be |
itf
|
the interface to use either CYW43_ITF_STA or CYW43_ITF_AP |
up
|
true to enable the link. Set to false to disable AP mode. Setting the up parameter to false for CYW43_ITF_STA is ignored. |
country
|
the country code, see CYW43_COUNTRY_ |
cyw43_wifi_update_multicast_filter
int cyw43_wifi_update_multicast_filter (cyw43_t * self, uint8_t * addr, bool add)
Add/remove multicast group address.
This method adds/removes an address from the multicast filter, allowing frames sent to this group to be received
Parameters
self
|
the driver state object. This should always be |
addr
|
a buffer containing a group mac address |
add
|
true to add the address, false to remove it |
Returns
0 on success
Variable Documentation
cyw43_state
cyw43_t cyw43_state
cyw43_poll
void(* cyw43_poll) (void)
cyw43_sleep
uint32_t cyw43_sleep
cyw43_ll
Low Level CYW43 driver interface.
Macros
-
#define CYW43_IOCTL_GET_SSID (0x32) -
#define CYW43_IOCTL_GET_CHANNEL (0x3a) -
#define CYW43_IOCTL_SET_DISASSOC (0x69) -
#define CYW43_IOCTL_GET_ANTDIV (0x7e) -
#define CYW43_IOCTL_SET_ANTDIV (0x81) -
#define CYW43_IOCTL_SET_MONITOR (0xd9) -
#define CYW43_IOCTL_GET_RSSI (0xfe) -
#define CYW43_IOCTL_GET_VAR (0x20c) -
#define CYW43_IOCTL_SET_VAR (0x20f) -
#define CYW43_EV_SET_SSID (0) -
#define CYW43_EV_JOIN (1) -
#define CYW43_EV_AUTH (3) -
#define CYW43_EV_DEAUTH (5) -
#define CYW43_EV_DEAUTH_IND (6) -
#define CYW43_EV_ASSOC (7) -
#define CYW43_EV_DISASSOC (11) -
#define CYW43_EV_DISASSOC_IND (12) -
#define CYW43_EV_LINK (16) -
#define CYW43_EV_PRUNE (23) -
#define CYW43_EV_PSK_SUP (46) -
#define CYW43_EV_ICV_ERROR (49) -
#define CYW43_EV_ESCAN_RESULT (69) -
#define CYW43_EV_CSA_COMPLETE_IND (80) -
#define CYW43_EV_ASSOC_REQ_IE (87) -
#define CYW43_EV_ASSOC_RESP_IE (88) -
#define CYW43_STATUS_SUCCESS (0) -
#define CYW43_STATUS_FAIL (1) -
#define CYW43_STATUS_TIMEOUT (2) -
#define CYW43_STATUS_NO_NETWORKS (3) -
#define CYW43_STATUS_ABORT (4) -
#define CYW43_STATUS_NO_ACK (5) -
#define CYW43_STATUS_UNSOLICITED (6) -
#define CYW43_STATUS_ATTEMPT (7) -
#define CYW43_STATUS_PARTIAL (8) -
#define CYW43_STATUS_NEWSCAN (9) -
#define CYW43_STATUS_NEWASSOC (10) -
#define CYW43_SUP_DISCONNECTED (0) -
#define CYW43_SUP_CONNECTING (1) -
#define CYW43_SUP_IDREQUIRED (2) -
#define CYW43_SUP_AUTHENTICATING (3) -
#define CYW43_SUP_AUTHENTICATED (4) -
#define CYW43_SUP_KEYXCHANGE (5) -
#define CYW43_SUP_KEYED (6) -
#define CYW43_SUP_TIMEOUT (7) -
#define CYW43_SUP_LAST_BASIC_STATE (8) -
#define CYW43_SUP_KEYXCHANGE_WAIT_M1 CYW43_SUP_AUTHENTICATED -
#define CYW43_SUP_KEYXCHANGE_PREP_M2 CYW43_SUP_KEYXCHANGE -
#define CYW43_SUP_KEYXCHANGE_WAIT_M3 CYW43_SUP_LAST_BASIC_STATE -
#define CYW43_SUP_KEYXCHANGE_PREP_M4 (9) -
#define CYW43_SUP_KEYXCHANGE_WAIT_G1 (10) -
#define CYW43_SUP_KEYXCHANGE_PREP_G2 (11) -
#define CYW43_REASON_INITIAL_ASSOC (0) -
#define CYW43_REASON_LOW_RSSI (1) -
#define CYW43_REASON_DEAUTH (2) -
#define CYW43_REASON_DISASSOC (3) -
#define CYW43_REASON_BCNS_LOST (4) -
#define CYW43_REASON_FAST_ROAM_FAILED (5) -
#define CYW43_REASON_DIRECTED_ROAM (6) -
#define CYW43_REASON_TSPEC_REJECTED (7) -
#define CYW43_REASON_BETTER_AP (8) -
#define CYW43_REASON_PRUNE_ENCR_MISMATCH (1) -
#define CYW43_REASON_PRUNE_BCAST_BSSID (2) -
#define CYW43_REASON_PRUNE_MAC_DENY (3) -
#define CYW43_REASON_PRUNE_MAC_NA (4) -
#define CYW43_REASON_PRUNE_REG_PASSV (5) -
#define CYW43_REASON_PRUNE_SPCT_MGMT (6) -
#define CYW43_REASON_PRUNE_RADAR (7) -
#define CYW43_REASON_RSN_MISMATCH (8) -
#define CYW43_REASON_PRUNE_NO_COMMON_RATES (9) -
#define CYW43_REASON_PRUNE_BASIC_RATES (10) -
#define CYW43_REASON_PRUNE_CCXFAST_PREVAP (11) -
#define CYW43_REASON_PRUNE_CIPHER_NA (12) -
#define CYW43_REASON_PRUNE_KNOWN_STA (13) -
#define CYW43_REASON_PRUNE_CCXFAST_DROAM (14) -
#define CYW43_REASON_PRUNE_WDS_PEER (15) -
#define CYW43_REASON_PRUNE_QBSS_LOAD (16) -
#define CYW43_REASON_PRUNE_HOME_AP (17) -
#define CYW43_REASON_PRUNE_AP_BLOCKED (18) -
#define CYW43_REASON_PRUNE_NO_DIAG_SUPPORT (19) -
#define CYW43_REASON_SUP_OTHER (0) -
#define CYW43_REASON_SUP_DECRYPT_KEY_DATA (1) -
#define CYW43_REASON_SUP_BAD_UCAST_WEP128 (2) -
#define CYW43_REASON_SUP_BAD_UCAST_WEP40 (3) -
#define CYW43_REASON_SUP_UNSUP_KEY_LEN (4) -
#define CYW43_REASON_SUP_PW_KEY_CIPHER (5) -
#define CYW43_REASON_SUP_MSG3_TOO_MANY_IE (6) -
#define CYW43_REASON_SUP_MSG3_IE_MISMATCH (7) -
#define CYW43_REASON_SUP_NO_INSTALL_FLAG (8) -
#define CYW43_REASON_SUP_MSG3_NO_GTK (9) -
#define CYW43_REASON_SUP_GRP_KEY_CIPHER (10) -
#define CYW43_REASON_SUP_GRP_MSG1_NO_GTK (11) -
#define CYW43_REASON_SUP_GTK_DECRYPT_FAIL (12) -
#define CYW43_REASON_SUP_SEND_FAIL (13) -
#define CYW43_REASON_SUP_DEAUTH (14) -
#define CYW43_REASON_SUP_WPA_PSK_TMO (15) -
#define CYW43_NO_POWERSAVE_MODE (0) -
#define CYW43_PM1_POWERSAVE_MODE (1) -
#define CYW43_PM2_POWERSAVE_MODE (2) -
#define CYW43_BUS_MAX_BLOCK_SIZE 16384 -
#define CYW43_BACKPLANE_READ_PAD_LEN_BYTES 0 -
#define CYW43_LL_STATE_SIZE_WORDS (526 + 1) -
#define CYW43_CHANNEL_NONE (0xffffffff)
Typedefs
typedef struct _cyw43_async_event_t cyw43_async_event_ttypedef struct _cyw43_ll_t cyw43_ll_t
Functions
void cyw43_ll_init (cyw43_ll_t *self, void *cb_data)void cyw43_ll_deinit (cyw43_ll_t *self)int cyw43_ll_bus_init (cyw43_ll_t *self, const uint8_t *mac)void cyw43_ll_bus_sleep (cyw43_ll_t *self, bool can_sleep)void cyw43_ll_process_packets (cyw43_ll_t *self)int cyw43_ll_ioctl (cyw43_ll_t *self, uint32_t cmd, size_t len, uint8_t *buf, uint32_t iface)int cyw43_ll_send_ethernet (cyw43_ll_t *self, int itf, size_t len, const void *buf, bool is_pbuf)int cyw43_ll_wifi_on (cyw43_ll_t *self, uint32_t country)int cyw43_ll_wifi_pm (cyw43_ll_t *self, uint32_t pm, uint32_t pm_sleep_ret, uint32_t li_bcn, uint32_t li_dtim, uint32_t li_assoc)int cyw43_ll_wifi_get_pm (cyw43_ll_t *self, uint32_t *pm, uint32_t *pm_sleep_ret, uint32_t *li_bcn, uint32_t *li_dtim, uint32_t *li_assoc)int cyw43_ll_wifi_scan (cyw43_ll_t *self, cyw43_wifi_scan_options_t *opts)int cyw43_ll_wifi_join (cyw43_ll_t *self, size_t ssid_len, const uint8_t *ssid, size_t key_len, const uint8_t *key, uint32_t auth_type, const uint8_t *bssid, uint32_t channel)void cyw43_ll_wifi_set_wpa_auth (cyw43_ll_t *self)void cyw43_ll_wifi_rejoin (cyw43_ll_t *self)int cyw43_ll_wifi_get_bssid (cyw43_ll_t *self_in, uint8_t *bssid)int cyw43_ll_wifi_ap_init (cyw43_ll_t *self, size_t ssid_len, const uint8_t *ssid, uint32_t auth, size_t key_len, const uint8_t *key, uint32_t channel)int cyw43_ll_wifi_ap_set_up (cyw43_ll_t *self, bool up)int cyw43_ll_wifi_ap_get_stas (cyw43_ll_t *self, int *num_stas, uint8_t *macs)int cyw43_ll_wifi_get_mac (cyw43_ll_t *self_in, uint8_t *addr)int cyw43_ll_wifi_update_multicast_filter (cyw43_ll_t *self_in, uint8_t *addr, bool add)bool cyw43_ll_has_work (cyw43_ll_t *self)bool cyw43_ll_bt_has_work (cyw43_ll_t *self)int cyw43_cb_read_host_interrupt_pin (void *cb_data)void cyw43_cb_ensure_awake (void *cb_data)void cyw43_cb_process_async_event (void *cb_data, const cyw43_async_event_t *ev)void cyw43_cb_process_ethernet (void *cb_data, int itf, size_t len, const uint8_t *buf)void cyw43_ll_write_backplane_reg (cyw43_ll_t *self_in, uint32_t addr, uint32_t val)uint32_t cyw43_ll_read_backplane_reg (cyw43_ll_t *self_in, uint32_t addr)int cyw43_ll_write_backplane_mem (cyw43_ll_t *self_in, uint32_t addr, uint32_t len, const uint8_t *buf)int cyw43_ll_read_backplane_mem (cyw43_ll_t *self_in, uint32_t addr, uint32_t len, uint8_t *buf)
anonymous enum
anonymous enum
Client interface STA mode. |
|
Access point (AP) interface mode. |
cyw43_ev_scan_result_t
typedef struct _cyw43_ev_scan_result_t cyw43_ev_scan_result_t
Structure to return wifi scan results.
cyw43_wifi_scan_options_t
typedef struct _cyw43_wifi_scan_options_t cyw43_wifi_scan_options_t
wifi scan options passed to cyw43_wifi_scan
Authorization types
CYW43_AUTH_OPEN
#define CYW43_AUTH_OPEN (0)
No authorisation required (open)
CYW43_AUTH_WPA_TKIP_PSK
#define CYW43_AUTH_WPA_TKIP_PSK (0x00200002)
WPA authorisation.
CYW43_AUTH_WPA2_AES_PSK
#define CYW43_AUTH_WPA2_AES_PSK (0x00400004)
WPA2 authorisation (preferred)
CYW43_AUTH_WPA2_MIXED_PSK
#define CYW43_AUTH_WPA2_MIXED_PSK (0x00400006)
WPA2/WPA mixed authorisation.
CYW43_AUTH_WPA3_SAE_AES_PSK
#define CYW43_AUTH_WPA3_SAE_AES_PSK (0x01000004)
WPA3 AES authorisation.
CYW43_AUTH_WPA3_WPA2_AES_PSK
#define CYW43_AUTH_WPA3_WPA2_AES_PSK (0x01400004)
WPA2/WPA3 authorisation
Macro Definition Documentation
CYW43_IOCTL_GET_SSID
#define CYW43_IOCTL_GET_SSID (0x32)
CYW43_IOCTL_GET_CHANNEL
#define CYW43_IOCTL_GET_CHANNEL (0x3a)
CYW43_IOCTL_SET_DISASSOC
#define CYW43_IOCTL_SET_DISASSOC (0x69)
CYW43_IOCTL_GET_ANTDIV
#define CYW43_IOCTL_GET_ANTDIV (0x7e)
CYW43_IOCTL_SET_ANTDIV
#define CYW43_IOCTL_SET_ANTDIV (0x81)
CYW43_IOCTL_SET_MONITOR
#define CYW43_IOCTL_SET_MONITOR (0xd9)
CYW43_IOCTL_GET_RSSI
#define CYW43_IOCTL_GET_RSSI (0xfe)
CYW43_IOCTL_GET_VAR
#define CYW43_IOCTL_GET_VAR (0x20c)
CYW43_IOCTL_SET_VAR
#define CYW43_IOCTL_SET_VAR (0x20f)
CYW43_EV_SET_SSID
#define CYW43_EV_SET_SSID (0)
CYW43_EV_JOIN
#define CYW43_EV_JOIN (1)
CYW43_EV_AUTH
#define CYW43_EV_AUTH (3)
CYW43_EV_DEAUTH
#define CYW43_EV_DEAUTH (5)
CYW43_EV_DEAUTH_IND
#define CYW43_EV_DEAUTH_IND (6)
CYW43_EV_ASSOC
#define CYW43_EV_ASSOC (7)
CYW43_EV_DISASSOC
#define CYW43_EV_DISASSOC (11)
CYW43_EV_DISASSOC_IND
#define CYW43_EV_DISASSOC_IND (12)
CYW43_EV_LINK
#define CYW43_EV_LINK (16)
CYW43_EV_PRUNE
#define CYW43_EV_PRUNE (23)
CYW43_EV_PSK_SUP
#define CYW43_EV_PSK_SUP (46)
CYW43_EV_ICV_ERROR
#define CYW43_EV_ICV_ERROR (49)
CYW43_EV_ESCAN_RESULT
#define CYW43_EV_ESCAN_RESULT (69)
CYW43_EV_CSA_COMPLETE_IND
#define CYW43_EV_CSA_COMPLETE_IND (80)
CYW43_EV_ASSOC_REQ_IE
#define CYW43_EV_ASSOC_REQ_IE (87)
CYW43_EV_ASSOC_RESP_IE
#define CYW43_EV_ASSOC_RESP_IE (88)
CYW43_STATUS_SUCCESS
#define CYW43_STATUS_SUCCESS (0)
CYW43_STATUS_FAIL
#define CYW43_STATUS_FAIL (1)
CYW43_STATUS_TIMEOUT
#define CYW43_STATUS_TIMEOUT (2)
CYW43_STATUS_NO_NETWORKS
#define CYW43_STATUS_NO_NETWORKS (3)
CYW43_STATUS_ABORT
#define CYW43_STATUS_ABORT (4)
CYW43_STATUS_NO_ACK
#define CYW43_STATUS_NO_ACK (5)
CYW43_STATUS_UNSOLICITED
#define CYW43_STATUS_UNSOLICITED (6)
CYW43_STATUS_ATTEMPT
#define CYW43_STATUS_ATTEMPT (7)
CYW43_STATUS_PARTIAL
#define CYW43_STATUS_PARTIAL (8)
CYW43_STATUS_NEWSCAN
#define CYW43_STATUS_NEWSCAN (9)
CYW43_STATUS_NEWASSOC
#define CYW43_STATUS_NEWASSOC (10)
CYW43_SUP_DISCONNECTED
#define CYW43_SUP_DISCONNECTED (0)
CYW43_SUP_CONNECTING
#define CYW43_SUP_CONNECTING (1)
CYW43_SUP_IDREQUIRED
#define CYW43_SUP_IDREQUIRED (2)
CYW43_SUP_AUTHENTICATING
#define CYW43_SUP_AUTHENTICATING (3)
CYW43_SUP_AUTHENTICATED
#define CYW43_SUP_AUTHENTICATED (4)
CYW43_SUP_KEYXCHANGE
#define CYW43_SUP_KEYXCHANGE (5)
CYW43_SUP_KEYED
#define CYW43_SUP_KEYED (6)
CYW43_SUP_TIMEOUT
#define CYW43_SUP_TIMEOUT (7)
CYW43_SUP_LAST_BASIC_STATE
#define CYW43_SUP_LAST_BASIC_STATE (8)
CYW43_SUP_KEYXCHANGE_WAIT_M1
#define CYW43_SUP_KEYXCHANGE_WAIT_M1 CYW43_SUP_AUTHENTICATED
CYW43_SUP_KEYXCHANGE_PREP_M2
#define CYW43_SUP_KEYXCHANGE_PREP_M2 CYW43_SUP_KEYXCHANGE
CYW43_SUP_KEYXCHANGE_WAIT_M3
#define CYW43_SUP_KEYXCHANGE_WAIT_M3 CYW43_SUP_LAST_BASIC_STATE
CYW43_SUP_KEYXCHANGE_PREP_M4
#define CYW43_SUP_KEYXCHANGE_PREP_M4 (9)
CYW43_SUP_KEYXCHANGE_WAIT_G1
#define CYW43_SUP_KEYXCHANGE_WAIT_G1 (10)
CYW43_SUP_KEYXCHANGE_PREP_G2
#define CYW43_SUP_KEYXCHANGE_PREP_G2 (11)
CYW43_REASON_INITIAL_ASSOC
#define CYW43_REASON_INITIAL_ASSOC (0)
CYW43_REASON_LOW_RSSI
#define CYW43_REASON_LOW_RSSI (1)
CYW43_REASON_DEAUTH
#define CYW43_REASON_DEAUTH (2)
CYW43_REASON_DISASSOC
#define CYW43_REASON_DISASSOC (3)
CYW43_REASON_BCNS_LOST
#define CYW43_REASON_BCNS_LOST (4)
CYW43_REASON_FAST_ROAM_FAILED
#define CYW43_REASON_FAST_ROAM_FAILED (5)
CYW43_REASON_DIRECTED_ROAM
#define CYW43_REASON_DIRECTED_ROAM (6)
CYW43_REASON_TSPEC_REJECTED
#define CYW43_REASON_TSPEC_REJECTED (7)
CYW43_REASON_BETTER_AP
#define CYW43_REASON_BETTER_AP (8)
CYW43_REASON_PRUNE_ENCR_MISMATCH
#define CYW43_REASON_PRUNE_ENCR_MISMATCH (1)
CYW43_REASON_PRUNE_BCAST_BSSID
#define CYW43_REASON_PRUNE_BCAST_BSSID (2)
CYW43_REASON_PRUNE_MAC_DENY
#define CYW43_REASON_PRUNE_MAC_DENY (3)
CYW43_REASON_PRUNE_MAC_NA
#define CYW43_REASON_PRUNE_MAC_NA (4)
CYW43_REASON_PRUNE_REG_PASSV
#define CYW43_REASON_PRUNE_REG_PASSV (5)
CYW43_REASON_PRUNE_SPCT_MGMT
#define CYW43_REASON_PRUNE_SPCT_MGMT (6)
CYW43_REASON_PRUNE_RADAR
#define CYW43_REASON_PRUNE_RADAR (7)
CYW43_REASON_RSN_MISMATCH
#define CYW43_REASON_RSN_MISMATCH (8)
CYW43_REASON_PRUNE_NO_COMMON_RATES
#define CYW43_REASON_PRUNE_NO_COMMON_RATES (9)
CYW43_REASON_PRUNE_BASIC_RATES
#define CYW43_REASON_PRUNE_BASIC_RATES (10)
CYW43_REASON_PRUNE_CCXFAST_PREVAP
#define CYW43_REASON_PRUNE_CCXFAST_PREVAP (11)
CYW43_REASON_PRUNE_CIPHER_NA
#define CYW43_REASON_PRUNE_CIPHER_NA (12)
CYW43_REASON_PRUNE_KNOWN_STA
#define CYW43_REASON_PRUNE_KNOWN_STA (13)
CYW43_REASON_PRUNE_CCXFAST_DROAM
#define CYW43_REASON_PRUNE_CCXFAST_DROAM (14)
CYW43_REASON_PRUNE_WDS_PEER
#define CYW43_REASON_PRUNE_WDS_PEER (15)
CYW43_REASON_PRUNE_QBSS_LOAD
#define CYW43_REASON_PRUNE_QBSS_LOAD (16)
CYW43_REASON_PRUNE_HOME_AP
#define CYW43_REASON_PRUNE_HOME_AP (17)
CYW43_REASON_PRUNE_AP_BLOCKED
#define CYW43_REASON_PRUNE_AP_BLOCKED (18)
CYW43_REASON_PRUNE_NO_DIAG_SUPPORT
#define CYW43_REASON_PRUNE_NO_DIAG_SUPPORT (19)
CYW43_REASON_SUP_OTHER
#define CYW43_REASON_SUP_OTHER (0)
CYW43_REASON_SUP_DECRYPT_KEY_DATA
#define CYW43_REASON_SUP_DECRYPT_KEY_DATA (1)
CYW43_REASON_SUP_BAD_UCAST_WEP128
#define CYW43_REASON_SUP_BAD_UCAST_WEP128 (2)
CYW43_REASON_SUP_BAD_UCAST_WEP40
#define CYW43_REASON_SUP_BAD_UCAST_WEP40 (3)
CYW43_REASON_SUP_UNSUP_KEY_LEN
#define CYW43_REASON_SUP_UNSUP_KEY_LEN (4)
CYW43_REASON_SUP_PW_KEY_CIPHER
#define CYW43_REASON_SUP_PW_KEY_CIPHER (5)
CYW43_REASON_SUP_MSG3_TOO_MANY_IE
#define CYW43_REASON_SUP_MSG3_TOO_MANY_IE (6)
CYW43_REASON_SUP_MSG3_IE_MISMATCH
#define CYW43_REASON_SUP_MSG3_IE_MISMATCH (7)
CYW43_REASON_SUP_NO_INSTALL_FLAG
#define CYW43_REASON_SUP_NO_INSTALL_FLAG (8)
CYW43_REASON_SUP_MSG3_NO_GTK
#define CYW43_REASON_SUP_MSG3_NO_GTK (9)
CYW43_REASON_SUP_GRP_KEY_CIPHER
#define CYW43_REASON_SUP_GRP_KEY_CIPHER (10)
CYW43_REASON_SUP_GRP_MSG1_NO_GTK
#define CYW43_REASON_SUP_GRP_MSG1_NO_GTK (11)
CYW43_REASON_SUP_GTK_DECRYPT_FAIL
#define CYW43_REASON_SUP_GTK_DECRYPT_FAIL (12)
CYW43_REASON_SUP_SEND_FAIL
#define CYW43_REASON_SUP_SEND_FAIL (13)
CYW43_REASON_SUP_DEAUTH
#define CYW43_REASON_SUP_DEAUTH (14)
CYW43_REASON_SUP_WPA_PSK_TMO
#define CYW43_REASON_SUP_WPA_PSK_TMO (15)
CYW43_NO_POWERSAVE_MODE
#define CYW43_NO_POWERSAVE_MODE (0)
Power save mode parameter passed to cyw43_ll_wifi_pm.
No Powersave mode
CYW43_PM1_POWERSAVE_MODE
#define CYW43_PM1_POWERSAVE_MODE (1)
Powersave mode on specified interface without regard for throughput reduction.
CYW43_PM2_POWERSAVE_MODE
#define CYW43_PM2_POWERSAVE_MODE (2)
Powersave mode on specified interface with High throughput.
CYW43_BUS_MAX_BLOCK_SIZE
#define CYW43_BUS_MAX_BLOCK_SIZE 16384
CYW43_BACKPLANE_READ_PAD_LEN_BYTES
#define CYW43_BACKPLANE_READ_PAD_LEN_BYTES 0
CYW43_LL_STATE_SIZE_WORDS
#define CYW43_LL_STATE_SIZE_WORDS (526 + 1)
CYW43_CHANNEL_NONE
#define CYW43_CHANNEL_NONE (0xffffffff)
To indicate no specific channel when calling cyw43_ll_wifi_join with bssid specified.
No Channel specified (use the AP’s channel)
Typedef Documentation
cyw43_async_event_t
typedef struct _cyw43_async_event_t cyw43_async_event_t
cyw43_ll_t
typedef struct _cyw43_ll_t cyw43_ll_t
Function Documentation
cyw43_cb_ensure_awake
void cyw43_cb_ensure_awake (void * cb_data)
cyw43_cb_process_async_event
void cyw43_cb_process_async_event (void * cb_data, const cyw43_async_event_t * ev)
cyw43_cb_process_ethernet
void cyw43_cb_process_ethernet (void * cb_data, int itf, size_t len, const uint8_t * buf)
cyw43_cb_read_host_interrupt_pin
int cyw43_cb_read_host_interrupt_pin (void * cb_data)
cyw43_ll_bt_has_work
bool cyw43_ll_bt_has_work (cyw43_ll_t * self)
cyw43_ll_bus_init
int cyw43_ll_bus_init (cyw43_ll_t * self, const uint8_t * mac)
cyw43_ll_bus_sleep
void cyw43_ll_bus_sleep (cyw43_ll_t * self, bool can_sleep)
cyw43_ll_deinit
void cyw43_ll_deinit (cyw43_ll_t * self)
cyw43_ll_has_work
bool cyw43_ll_has_work (cyw43_ll_t * self)
cyw43_ll_init
void cyw43_ll_init (cyw43_ll_t * self, void * cb_data)
cyw43_ll_ioctl
int cyw43_ll_ioctl (cyw43_ll_t * self, uint32_t cmd, size_t len, uint8_t * buf, uint32_t iface)
cyw43_ll_process_packets
void cyw43_ll_process_packets (cyw43_ll_t * self)
cyw43_ll_read_backplane_mem
int cyw43_ll_read_backplane_mem (cyw43_ll_t * self_in, uint32_t addr, uint32_t len, uint8_t * buf)
cyw43_ll_read_backplane_reg
uint32_t cyw43_ll_read_backplane_reg (cyw43_ll_t * self_in, uint32_t addr)
cyw43_ll_send_ethernet
int cyw43_ll_send_ethernet (cyw43_ll_t * self, int itf, size_t len, const void * buf, bool is_pbuf)
cyw43_ll_wifi_ap_get_stas
int cyw43_ll_wifi_ap_get_stas (cyw43_ll_t * self, int * num_stas, uint8_t * macs)
cyw43_ll_wifi_ap_init
int cyw43_ll_wifi_ap_init (cyw43_ll_t * self, size_t ssid_len, const uint8_t * ssid, uint32_t auth, size_t key_len, const uint8_t * key, uint32_t channel)
cyw43_ll_wifi_ap_set_up
int cyw43_ll_wifi_ap_set_up (cyw43_ll_t * self, bool up)
cyw43_ll_wifi_get_bssid
int cyw43_ll_wifi_get_bssid (cyw43_ll_t * self_in, uint8_t * bssid)
cyw43_ll_wifi_get_mac
int cyw43_ll_wifi_get_mac (cyw43_ll_t * self_in, uint8_t * addr)
cyw43_ll_wifi_get_pm
int cyw43_ll_wifi_get_pm (cyw43_ll_t * self, uint32_t * pm, uint32_t * pm_sleep_ret, uint32_t * li_bcn, uint32_t * li_dtim, uint32_t * li_assoc)
cyw43_ll_wifi_join
int cyw43_ll_wifi_join (cyw43_ll_t * self, size_t ssid_len, const uint8_t * ssid, size_t key_len, const uint8_t * key, uint32_t auth_type, const uint8_t * bssid, uint32_t channel)
cyw43_ll_wifi_on
int cyw43_ll_wifi_on (cyw43_ll_t * self, uint32_t country)
cyw43_ll_wifi_pm
int cyw43_ll_wifi_pm (cyw43_ll_t * self, uint32_t pm, uint32_t pm_sleep_ret, uint32_t li_bcn, uint32_t li_dtim, uint32_t li_assoc)
cyw43_ll_wifi_rejoin
void cyw43_ll_wifi_rejoin (cyw43_ll_t * self)
cyw43_ll_wifi_scan
int cyw43_ll_wifi_scan (cyw43_ll_t * self, cyw43_wifi_scan_options_t * opts)
cyw43_ll_wifi_set_wpa_auth
void cyw43_ll_wifi_set_wpa_auth (cyw43_ll_t * self)
cyw43_ll_wifi_update_multicast_filter
int cyw43_ll_wifi_update_multicast_filter (cyw43_ll_t * self_in, uint8_t * addr, bool add)
cyw43_ll_write_backplane_mem
int cyw43_ll_write_backplane_mem (cyw43_ll_t * self_in, uint32_t addr, uint32_t len, const uint8_t * buf)
cyw43_ll_write_backplane_reg
void cyw43_ll_write_backplane_reg (cyw43_ll_t * self_in, uint32_t addr, uint32_t val)