Raspberry Pi Documentation

Release 1.5.0

Networking Libraries

Functions for implementing networking

pico_btstack

Integration/wrapper libraries for BTstack the documentation for which is here. More...

Functions

Detailed Description

Integration/wrapper libraries for BTstack the documentation for which is 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 ibraries 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.

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 alsopico_btstack_cyw43 in pico_cyw43_driver, which adds the cyw43 driver support needed for BTstack including BTstack run loop support.

Function Documentation

◆ 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 eturn 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 at the end of flash are used (see PICO_FLASH_BANK_STORAGE_OFFSET

pico_lwip

Integration/wrapper libraries for lwIP the documentation for which is here. More...

Modules

  •  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_freertos

  •  Glue library for integration lwIP in NO_SYS=0 mode with the SDK. Simple init and deinit are all that is required to hook up lwIP (with full blocking API support) via an async_context instance.

  •  pico_lwip_nosys

  •  Glue library for integration lwIP in NO_SYS=1 mode with the SDK. Simple init and deinit are all that is required to hook up lwIP via an async_context instance.

Detailed Description

Integration/wrapper libraries for lwIP the documentation for which is here.

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 -

pico_lwip_arch

lwIP compiler adapters. This is not included by default in pico_lwip in case you wish to implement your own.

lwIP compiler adapters. This is not included by default in pico_lwip in case you wish to implement your own.

pico_lwip_freertos

Glue library for integration lwIP in NO_SYS=0 mode with the SDK. Simple init and deinit are all that is required to hook up lwIP (with full blocking API support) via an async_context instance. More...

Functions

Detailed Description

Glue library for integration lwIP in NO_SYS=0 mode with the SDK. Simple init and deinit are all that is required to hook up lwIP (with full blocking API support) via an async_context instance.

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. Simple init and deinit are all that is required to hook up lwIP via an async_context instance. More...

Functions

Detailed Description

Glue library for integration lwIP in NO_SYS=1 mode with the SDK. Simple init and deinit are all that is required to hook up lwIP via an async_context instance.

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

Modules

Files

Functions

Detailed Description

A wrapper around the lower level cyw43_driver, that integrates it with pico_async_context for handling background work.

Function Documentation

◆ cyw43_driver_deinit()

void cyw43_driver_deinit ( async_context_t 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 ( async_context_t 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

◆ hci_transport_cyw43_instance()

const hci_transport_t * hci_transport_cyw43_instance ( void  )

Get the Bluetooth HCI transport instance for cyw43.

Returns

An instantiation of the hci_transport_t interface for the cyw43 chipset

Pico_bstack_cyw43

Low-level Bluetooth HCI support.

Low-level Bluetooth HCI support.

This library provides utility functions to initialise and de-initialise BTstack for CYW43,

pico_cyw43_arch

Modules

Macros

  • #define cyw43_arch_lwip_check()   cyw43_thread_lock_check()

  •  Checks the caller has any locks required for calling into lwIP.

Functions

Detailed Description

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

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 pico_cyw43_arch library no longer directly implements the distinct behavioral abstractions. This is now handled by the more general pico_async_context library. The user facing behavior of pico_cyw43_arch has not changed as a result of this implementation detail, however pico_cyw43_arch is now just a thin wrapper which creates an appropriate async_context and makes a simple call to add lwIP or cyw43_driver support as appropriate. You are free to perform this context creation and adding of lwIP, cyw43_driver or indeed any other additional future protocol/driver support to your async_context, however for now pico_cyw43_arch does still provide a few cyw43_ specific (i.e. Pico W) APIs for connection management, locking and GPIO interaction.

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 cyw43_driver and lwIP support, please refer to the specific source files cyw43_arch_poll.c, cyw43_arch_threadsafe_background.c and cyw43_arch_freertos.c.

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=1 mode) without any background processing or multi-core/thread safety.

    The user must call pico_cyw43_poll periodically from their main loop.

    This wrapper library:

    • Sets CYW43_LWIP=1 to enable lwIP support in pico_cyw43_arch and cyw43_driver.

    • Sets PICO_CYW43_ARCH_POLL=1 to select the polling behavior.

    • Adds the pico_lwip as a dependency to pull in lwIP.

  • pico_cyw43_arch_lwip_threadsafe_background - For using the RAW lwIP API (in NO_SYS=1 mode) with multi-core/thread safety, and automatic servicing of the cyw43_driver and lwIP in background.

    Calls into the cyw43_driver high 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.

    Note
    lwIP 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=1 to enable lwIP support in pico_cyw43_arch and cyw43_driver

    • Sets PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 to 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=1 mode (allowing you to call cyw43_driver APIs 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 (with NO_SYS=0) provided by pico_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 the cyw43_driver and the lwIP stack.

    This wrapper library:

    • Sets CYW43_LWIP=1 to enable lwIP support in pico_cyw43_arch and cyw43_driver.

    • Sets PICO_CYW43_ARCH_FREERTOS=1 to select the NO_SYS=0 lwip/FreeRTOS integration

    • Sets LWIP_PROVIDE_ERRNO=1 to provide error numbers needed for compilation without an OS

    • Adds the pico_lwip as a dependency to pull in lwIP.

    • Adds the lwIP/FreeRTOS code from lwip-contrib (in the contrib directory of lwIP)

    Calls into the cyw43_driver high 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.

    Note
    this 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=0 to disable lwIP support in pico_cyw43_arch and cyw43_driver

Macro Definition Documentation

◆ cyw43_arch_lwip_check

void cyw43_arch_lwip_check (   void )    cyw43_thread_lock_check()

Checks the caller has any locks required for calling into lwIP.

The lwIP API is not thread safe. You should surround calls into the lwIP API with calls to cyw43_arch_lwip_begin and this method. Note these calls are not necessary (but harmless) when you are calling back into the lwIP API from an lwIP callback.

This method will assert in debug mode, if the above conditions are not met (i.e. it is not safe to call into the lwIP API)

Note
as of SDK release 1.5.0, this is now equivalent to calling async_context_lock_check on the async_context associated with cyw43_arch and lwIP.

See alsocyw43_arch_lwip_begin cyw43_arch_lwip_protect async_context_lock_check cyw43_arch_async_context

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_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 \emStation 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 PICO_CYW43_ARCH_DEFAULT_COUNTRY_CODE which defaults to CYW43_COUNTRY_WORLDWIDE. Worldwide settings may not give the best performance; consider setting PICO_CYW43_ARCH_DEFAULT_COUNTRY_CODE to a different value or calling cyw43_arch_init_with_country

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 alsopico_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 alsopico_error_codes

◆ cyw43_arch_lwip_begin()

cyw43_arch_lwip_begin ( void  )
inlinestatic

Acquire any locks required to call into lwIP.

The lwIP API is not thread safe. You should surround calls into the lwIP API with calls to this method and cyw43_arch_lwip_end. Note these calls are not necessary (but harmless) when you are calling back into the lwIP API from an lwIP callback. If you are using single-core polling only (pico_cyw43_arch_poll) then these calls are no-ops anyway it is good practice to call them anyway where they are necessary.

Note
as of SDK release 1.5.0, this is now equivalent to calling pico_async_context_acquire_lock_blocking on the async_context associated with cyw43_arch and lwIP.

See alsocyw43_arch_lwip_end cyw43_arch_lwip_protect async_context_acquire_lock_blocking cyw43_arch_async_context

◆ cyw43_arch_lwip_end()

void cyw43_arch_lwip_end ( void  )
inlinestatic

Release any locks required for calling into lwIP.

The lwIP API is not thread safe. You should surround calls into the lwIP API with calls to cyw43_arch_lwip_begin and this method. Note these calls are not necessary (but harmless) when you are calling back into the lwIP API from an lwIP callback. If you are using single-core polling only (pico_cyw43_arch_poll) then these calls are no-ops anyway it is good practice to call them anyway where they are necessary.

Note
as of SDK release 1.5.0, this is now equivalent to calling async_context_release_lock on the async_context associated with cyw43_arch and lwIP.

See alsocyw43_arch_lwip_begin cyw43_arch_lwip_protect async_context_release_lock cyw43_arch_async_context

◆ cyw43_arch_lwip_protect()

int cyw43_arch_lwip_protect ( int(*)(void *param)  func,
void *  param 
)
inlinestatic

sad Release any locks required for calling into lwIP

The lwIP API is not thread safe. You can use this method to wrap a function with any locking required to call into the lwIP API. If you are using single-core polling only (pico_cyw43_arch_poll) then there are no locks to required, but it is still good practice to use this function.

Parameters

func the function ta call with any required locks held
param parameter to pass to func

Returns

the return value from func

See alsocyw43_arch_lwip_begin cyw43_arch_lwip_end

◆ 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 alsopico_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 initialization is successful, an error code otherwise

See alsopico_error_codes

◆ 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
password 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 alsopico_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
password 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 initialization is successful, an error code otherwise

See alsopico_error_codes

◆ 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
password 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 initialization is successful, an error code otherwise

See alsopico_error_codes

◆ 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_)

Returns

0 if the initialization is successful, an error code otherwise

See alsopico_error_codes

cyw43_driver

Driver used for Pico W wireless. More...

Modules

  •  cyw43_ll

  •  Low Level CYW43 driver interface.

Files

Data Structures

Macros

  • #define CYW43_DEFAULT_PM   cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 200, 1, 1, 10)

  •  Default power management mode.

  • #define CYW43_AGGRESSIVE_PM   cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 2000, 1, 1, 10)

  •  Aggressive power management mode for optimial power usage at the cost of performance.

  • #define CYW43_PERFORMANCE_PM   cyw43_pm_value(CYW43_PM2_POWERSAVE_MODE, 20, 1, 1, 1)

  •  Performance power management mode where more power is used to increase performance.

  • #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

Typedefs

Functions

Variables

  • cyw43_t cyw43_state

  • void(* cyw43_poll )(void)

  • uint32_t cyw43_sleep

Trace flags

  • #define CYW43_TRACE_ASYNC_EV   (0x0001)

  • #define CYW43_TRACE_ETH_TX   (0x0002)

  • #define CYW43_TRACE_ETH_RX   (0x0004)

  • #define CYW43_TRACE_ETH_FULL   (0x0008)

  • #define CYW43_TRACE_MAC   (0x0010)

Link status

See alsostatus_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

  • #define CYW43_LINK_DOWN   (0)

  •  link is down

  • #define CYW43_LINK_JOIN   (1)

  •  Connected to wifi.

  • #define CYW43_LINK_NOIP   (2)

  •  Connected to wifi, but no IP address.

  • #define CYW43_LINK_UP   (3)

  •  Connect to wifi with an IP address.

  • #define CYW43_LINK_FAIL   (-1)

  •  Connection failed.

  • #define CYW43_LINK_NONET   (-2)

  •  No matching SSID found (could be out of range, or down)

  • #define CYW43_LINK_BADAUTH   (-3)

Country codes

Detailed Description

Driver used for Pico W wireless.

Macro Definition Documentation

◆ CYW43_LINK_BADAUTH
#define CYW43_LINK_BADAUTH   (-3)

Authenticatation failure

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 &cyw43_state
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 &cyw43_state
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 &cyw43_state
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 &cyw43_state
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_state
◆ 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_state
◆ 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 &cyw43_state
cmd the command to send
len the amount of data to send with the commannd
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 )
inlinestatic

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 &cyw43_state

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 
)
inlinestatic

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.

See alsoCYW43_DEFAULT_PM CYW43_AGGRESSIVE_PM CYW43_PERFORMANCE_PM

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 &cyw43_state
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 &cyw43_state
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 )
inlinestatic

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 &cyw43_state

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 &cyw43_state
max_stas Returns the maximum number of devices (STAs) that can be connected to the access point
◆ cyw43_wifi_ap_get_ssid()
static void cyw43_wifi_ap_get_ssid ( cyw43_t self,
size_t *  len,
const uint8_t **  buf 
)
inlinestatic

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 &cyw43_state
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 &cyw43_state
num_stas Returns the number of devices (STA) connected to the access point
macs Returns the mac addresses of devies (STA) connected to the access point. The supplied buffer should have enough room for 6 bytes per mac address. 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 
)
inlinestatic

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 &cyw43_state
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 
)
inlinestatic

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 &cyw43_state
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 
)
inlinestatic

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 &cyw43_state
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 
)
inlinestatic

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 &cyw43_state
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[6] 
)

Get the BSSID of the connected wifi network.

Parameters

self the driver state object. This should always be &cyw43_state
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[6] 
)

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 &cyw43_state
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 alsocyw43_pm_value for an explanation of these values This should be called after cyw43_wifi_set_up

Parameters

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 &cyw43_state
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 dissassociate from a wifi network.

Parameters

self the driver state object. This should always be &cyw43_state
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 alsoCYW43_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 
)

Dissassociate from a wifi network.

This method dissassociates from a wifi network.

Parameters

self the driver state object. This should always be &cyw43_state
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 &cyw43_state
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

See alsocyw43_pm_value CYW43_DEFAULT_PM CYW43_AGGRESSIVE_PM CYW43_PERFORMANCE_PM

Parameters

self the driver state object. This should always be &cyw43_state
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 &cyw43_state
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 )
inlinestatic

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 &cyw43_state

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 &cyw43_state
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 &cyw43_state
addr a buffer containing a group mac address
add true to add the address, false to remove it

Returns

0 on success

cyw43_ll

Low Level CYW43 driver interface. More...

Files
  • file  cyw43_ll.h

  •  Low Level CYW43 driver interface.

Data Structures
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_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_WPA_AUTH_PSK   (0x0004)

  • #define CYW43_WPA2_AUTH_PSK   (0x0080)

  • #define CYW43_NO_POWERSAVE_MODE   (0)

  •  Power save mode paramter passed to cyw43_ll_wifi_pm.

  • #define CYW43_PM1_POWERSAVE_MODE   (1)

  •  Powersave mode on specified interface without regard for throughput reduction.

  • #define CYW43_PM2_POWERSAVE_MODE   (2)

  •  Powersave mode on specified interface with High throughput.

  • #define CYW43_BUS_MAX_BLOCK_SIZE   16384

  • #define CYW43_CHANNEL_NONE   (0xffffffff)

  •  To indicate no specific channel when calling cyw43_ll_wifi_join with bssid specified.

Typedefs
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)

  • enum  { CYW43_ITF_STA , CYW43_ITF_AP }

  •  Network interface types . More...

  • typedef struct _cyw43_ev_scan_result_t cyw43_ev_scan_result_t

  •  Structure to return wifi scan results.

  • typedef struct _cyw43_wifi_scan_options_t cyw43_wifi_scan_options_t

  •  wifi scan options passed to cyw43_wifi_scan

Authorization types

Used when setting up an access point, or connecting to an access point

  • #define CYW43_AUTH_OPEN   (0)

  •  No authorisation required (open)

  • #define CYW43_AUTH_WPA_TKIP_PSK   (0x00200002)

  •  WPA authorisation.

  • #define CYW43_AUTH_WPA2_AES_PSK   (0x00400004)

  •  WPA2 authorisation (preferred)

  • #define CYW43_AUTH_WPA2_MIXED_PSK   (0x00400006)

Detailed Description

Low Level CYW43 driver interface.

Macro Definition Documentation
◆ CYW43_AUTH_WPA2_MIXED_PSK
#define CYW43_AUTH_WPA2_MIXED_PSK   (0x00400006)

WPA2/WPA mixed authorisation

◆ 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)

◆ CYW43_NO_POWERSAVE_MODE
#define CYW43_NO_POWERSAVE_MODE   (0)

Power save mode paramter passed to cyw43_ll_wifi_pm.

No Powersave mode

Enumeration Type Documentation
◆ anonymous enum
anonymous enum

Network interface types .

Enumerator
CYW43_ITF_STA 

Client interface STA mode.

CYW43_ITF_AP 

Access point (AP) interface mode.