Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
csk_wifi.h File Reference

Go to the source code of this file.

Data Structures

struct  csk_wifi_sta_config_t
 CSK WiFi station configuration struct. More...
 
struct  csk_wifi_softap_config_t
 CSK WiFi softap configuration struct. More...
 
struct  csk_wifi_scan_info_t
 CSK WiFi scan info type. More...
 
struct  csk_wifi_event_cb
 CSK WIFI callback structure. More...
 

Macros

#define CSK_WIFI_SSID_LEN   32
 
#define CSK_WIFI_BSSID_LEN   17
 
#define CSK_WIFI_PWD_LEN   64
 
#define CSK_WIFI_STATUS_STA_CONNECTED   0
 
#define CSK_WIFI_STATUS_STA_DISCONNECTED   2
 
#define CSK_WIFI_STATUS_STA_UNKNOWN   3
 

Typedefs

typedef void(* wifi_event_cb_t) (csk_wifi_event_t event, void *event_data, uint32_t event_data_len, void *arg)
 
typedef struct csk_wifi_event_cb csk_wifi_event_cb_t
 CSK WIFI callback structure. More...
 

Enumerations

enum  csk_wifi_encryption_mode_t {
  CSK_WIFI_AUTH_OPEN = 0 , CSK_WIFI_AUTH_WEP , CSK_WIFI_AUTH_WPA_PSK , CSK_WIFI_AUTH_WPA2_PSK ,
  CSK_WIFI_AUTH_WPA_WPA2_PSK , CSK_WIFI_AUTH_WPA2_ENTERPRISE , CSK_WIFI_AUTH_WPA3_PSK , CSK_WIFI_AUTH_WPA2_WPA3_PSK ,
  CSK_WIFI_AUTH_MAX
}
 CSK WiFi encryption mode. More...
 
enum  csk_wifi_bandwidth_t { CSK_WIFI_BW_HT20 = 0 , CSK_WIFI_BW_HT40 }
 CSK WiFi bandwidth mode. More...
 
enum  csk_wifi_result_t {
  CSK_WIFI_SUCCESS , CSK_WIFI_ERR_STA_FAILED , CSK_WIFI_ERR_AP_FAILED , CSK_WIFI_ERR_AP_NOT_FOUND ,
  CSK_WIFI_ERR_INVALID_PASSWORD , CSK_WIFI_ERR_SCAN_FAILED
}
 CSK WiFi operation(API) results structure. More...
 
enum  csk_wifi_event_t {
  CSK_WIFI_EVT_STA_CONNECTED = BIT(0) , CSK_WIFI_EVT_STA_DISCONNECTED = BIT(1) , CSK_WIFI_EVT_AP_STARTED = BIT(2) , CSK_WIFI_EVT_AP_STOPPED = BIT(3) ,
  CSK_WIFI_EVT_AP_STACONNECTED = BIT(4) , CSK_WIFI_EVT_AP_STADISCONNECTED = BIT(5) , CSK_WIFI_EVT_SCAN_DONE = BIT(6) , CSK_WIFI_EVT_STA_CONNECTING = BIT(7)
}
 CSK WiFi events structure. More...
 

Functions

int csk_wifi_init (void)
 CSK WiFi driver initialize. More...
 
int csk_wifi_deinit (void)
 CSK WiFi driver deinitialize. More...
 
int csk_wifi_add_callback (csk_wifi_event_cb_t *wifi_event_cb)
 Add an wifi event callback. More...
 
int csk_wifi_remove_callback (csk_wifi_event_cb_t *wifi_event_cb)
 Remove an wifi event callback. More...
 
int csk_wifi_scan_ap (csk_wifi_scan_info_t **ap_info, csk_wifi_result_t *result, k_timeout_t timeout)
 Scan the neighboring AP device. More...
 

Macro Definition Documentation

◆ CSK_WIFI_BSSID_LEN

#define CSK_WIFI_BSSID_LEN   17

◆ CSK_WIFI_PWD_LEN

#define CSK_WIFI_PWD_LEN   64

◆ CSK_WIFI_SSID_LEN

#define CSK_WIFI_SSID_LEN   32

◆ CSK_WIFI_STATUS_STA_CONNECTED

#define CSK_WIFI_STATUS_STA_CONNECTED   0

◆ CSK_WIFI_STATUS_STA_DISCONNECTED

#define CSK_WIFI_STATUS_STA_DISCONNECTED   2

◆ CSK_WIFI_STATUS_STA_UNKNOWN

#define CSK_WIFI_STATUS_STA_UNKNOWN   3

Typedef Documentation

◆ csk_wifi_event_cb_t

CSK WIFI callback structure.

Used to register a callback in the csk_wifi driver instance callback list. As many callbacks as needed can be added as long as each of them are unique pointers of struct csk_wifi_event_cb. Beware such structure should not be allocated on stack.

TODO: add a callback initializer

◆ wifi_event_cb_t

typedef void(* wifi_event_cb_t) (csk_wifi_event_t event, void *event_data, uint32_t event_data_len, void *arg)

WIFI event handler type (will be invoked in csk_wifi_event_cb_t)

Enumeration Type Documentation

◆ csk_wifi_bandwidth_t

CSK WiFi bandwidth mode.

Enumerator
CSK_WIFI_BW_HT20 
CSK_WIFI_BW_HT40 

◆ csk_wifi_encryption_mode_t

CSK WiFi encryption mode.

Enumerator
CSK_WIFI_AUTH_OPEN 
CSK_WIFI_AUTH_WEP 
CSK_WIFI_AUTH_WPA_PSK 
CSK_WIFI_AUTH_WPA2_PSK 
CSK_WIFI_AUTH_WPA_WPA2_PSK 
CSK_WIFI_AUTH_WPA2_ENTERPRISE 
CSK_WIFI_AUTH_WPA3_PSK 
CSK_WIFI_AUTH_WPA2_WPA3_PSK 
CSK_WIFI_AUTH_MAX 

◆ csk_wifi_event_t

CSK WiFi events structure.

Enumerator
CSK_WIFI_EVT_STA_CONNECTED 
CSK_WIFI_EVT_STA_DISCONNECTED 
CSK_WIFI_EVT_AP_STARTED 
CSK_WIFI_EVT_AP_STOPPED 
CSK_WIFI_EVT_AP_STACONNECTED 
CSK_WIFI_EVT_AP_STADISCONNECTED 
CSK_WIFI_EVT_SCAN_DONE 
CSK_WIFI_EVT_STA_CONNECTING 

◆ csk_wifi_result_t

CSK WiFi operation(API) results structure.

Enumerator
CSK_WIFI_SUCCESS 
CSK_WIFI_ERR_STA_FAILED 
CSK_WIFI_ERR_AP_FAILED 
CSK_WIFI_ERR_AP_NOT_FOUND 
CSK_WIFI_ERR_INVALID_PASSWORD 
CSK_WIFI_ERR_SCAN_FAILED 

Function Documentation

◆ csk_wifi_add_callback()

int csk_wifi_add_callback ( csk_wifi_event_cb_t wifi_event_cb)

Add an wifi event callback.

Parameters
wifi_event_cb[in]Application's callback structure pointer.
Returns
0 if successful, negative errno code on failure.

◆ csk_wifi_deinit()

int csk_wifi_deinit ( void  )

CSK WiFi driver deinitialize.

Returns
0 if successful, negative errno code on failure.

◆ csk_wifi_init()

int csk_wifi_init ( void  )

CSK WiFi driver initialize.

Returns
0 if successful, negative errno code on failure.

◆ csk_wifi_remove_callback()

int csk_wifi_remove_callback ( csk_wifi_event_cb_t wifi_event_cb)

Remove an wifi event callback.

Parameters
wifi_event_cb[in]Application's callback structure pointer.
Return values
0Success
-ENXIO(6)wifi event callback not found

◆ csk_wifi_scan_ap()

int csk_wifi_scan_ap ( csk_wifi_scan_info_t **  ap_info,
csk_wifi_result_t result,
k_timeout_t  timeout 
)

Scan the neighboring AP device.

Parameters
ap_info[in/out]Pointer to WiFi AP information structure
result[out]Pointer to WIFI operation result
timeout[in]How long to try to scan neighboring WIFI Access Point
Note
timeout parameter only supports K_FOREVER or K_NO_WAIT
Returns
Number of neighboring APs imformation
Return values
-EAGAIN(11)errno code if timeout or invalid state
-ENOMEM(12)errno code if insufficient memory
-EIO(5)errno code if wlan driver exceptions occur