Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
csk_wifi_priv.h File Reference
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <kernel.h>
#include <net/ethernet.h>
#include <net/net_pkt.h>
#include <net/net_if.h>
#include "csk6/csk_wifi.h"

Go to the source code of this file.

Data Structures

struct  csk_wifi_data
 
struct  wifi_req_t
 
struct  wifi_ret_msg_t
 
struct  wifi_scan_list_t
 

Macros

#define CSK_WIFI_CHECK(cond, ret_val)
 
#define CSK_WIFI_CHECK_RETURN(cond, ret_val, format, ...)
 
#define CSK_WIFI_CHECK_GOTO(cond, label, format, ...)
 
#define FOREACH_WIFI_STA_SM(WIFI_SM)
 
#define FOREACH_WLAN_EVENT(WLAN_EVENT)
 
#define GENERATE_ENUM(ENUM)   ENUM,
 
#define GENERATE_STRING(STRING)   #STRING,
 
#define WIFI_STA_SM_PRIMARY_GET(a)   ((uint16_t)((a)))
 
#define WIFI_STA_SM_PRIMARY_SET(a, b)
 

Typedefs

typedef uint32_t wifi_fsm_t
 

Enumerations

enum  wifi_sta_state_machine_t {
  WIFI_SM_ON_STARTUP , WIFI_SM_STARTUP_DONE , WIFI_SM_STA_CONNECTED , WIFI_SM_STA_DISCONNECTED ,
  WIFI_SM_STA_ON_CONNECT , WIFI_SM_STA_ON_CONNECT_SCAN , WIFI_SM_STA_ON_AUTH_EXCEPTION , WIFI_SM_STA_ON_ASSOC_EXCEPTION ,
  WIFI_SM_STA_ON_HANDSHAKE_EXCEPTION , WIFI_SM_ON_CMDTIMEOUT_EXCEPTION , WIFI_SM_STA_ON_DISCONNECT , WIFI_SM_STA_ON_SCAN ,
  WIFI_SM_STA_SCAN_DONE
}
 
enum  csk_wifi_mode_t { CSK_WIFI_MODE_STA , CSK_WIFI_MODE_AP , CSK_WIFI_MODE_MAX }
 
enum  wifi_cmd_t {
  WIFI_CMD_INIT , WIFI_CMD_DEINIT , WIFI_CMD_STA_INIT , WIFI_CMD_STA_CONNECT ,
  WIFI_CMD_STA_DISCONNECT , WIFI_CMD_AP_INIT , WIFI_CMD_AP_START , WIFI_CMD_AP_STOP ,
  WIFI_CMD_SCAN
}
 

Functions

const struct devicewifi_obj_get_dev (csk_wifi_mode_t mode)
 
int wifi_send_command (const struct device *dev, wifi_cmd_t command, k_timeout_t timeouts)
 
int wifi_take_result (wifi_ret_msg_t *ret_msg, k_timeout_t timeout)
 
void wifi_dispatch_callbacks (csk_wifi_event_t events, void *event_data, uint32_t event_data_len)
 

Variables

const char * WIFI_STA_SM_STRINGS []
 

Macro Definition Documentation

◆ CSK_WIFI_CHECK

#define CSK_WIFI_CHECK (   cond,
  ret_val 
)
Value:
({ \
if (!(cond)) { \
LOG_ERR("%s:%d Check failed", __FUNCTION__, __LINE__); \
return (ret_val); \
} \
})

◆ CSK_WIFI_CHECK_GOTO

#define CSK_WIFI_CHECK_GOTO (   cond,
  label,
  format,
  ... 
)
Value:
({ \
if (!(cond)) { \
LOG_ERR("%s:%d Check failed", __FUNCTION__, __LINE__); \
LOG_ERR(format, ##__VA_ARGS__); \
goto label; \
} \
})

◆ CSK_WIFI_CHECK_RETURN

#define CSK_WIFI_CHECK_RETURN (   cond,
  ret_val,
  format,
  ... 
)
Value:
({ \
if (!(cond)) { \
LOG_ERR("%s:%d Check failed", __FUNCTION__, __LINE__); \
LOG_ERR(format, ##__VA_ARGS__); \
return (ret_val); \
} \
})

◆ FOREACH_WIFI_STA_SM

#define FOREACH_WIFI_STA_SM (   WIFI_SM)
Value:
WIFI_SM(WIFI_SM_ON_STARTUP) \
@ WIFI_SM_STA_CONNECTED
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_SCAN_DONE
Definition: csk_wifi_priv.h:117
@ WIFI_SM_ON_CMDTIMEOUT_EXCEPTION
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_ON_HANDSHAKE_EXCEPTION
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_ON_ASSOC_EXCEPTION
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_ON_CONNECT_SCAN
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STARTUP_DONE
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_ON_CONNECT
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_ON_DISCONNECT
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_DISCONNECTED
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_ON_SCAN
Definition: csk_wifi_priv.h:117
@ WIFI_SM_STA_ON_AUTH_EXCEPTION
Definition: csk_wifi_priv.h:117
@ WIFI_SM_ON_STARTUP
Definition: csk_wifi_priv.h:117

◆ FOREACH_WLAN_EVENT

#define FOREACH_WLAN_EVENT (   WLAN_EVENT)
Value:
WLAN_EVENT(WLAN_EVENT_CONNECTED) \
WLAN_EVENT(WLAN_EVENT_DISCONNECTED) \
WLAN_EVENT(WLAN_EVENT_SCAN_SUCCESS) \
WLAN_EVENT(WLAN_EVENT_SCAN_FAILED) \
WLAN_EVENT(WLAN_EVENT_4WAY_HANDSHAKE_FAILED) \
WLAN_EVENT(WLAN_EVENT_SSID_NOT_FOUND) \
WLAN_EVENT(WLAN_EVENT_AUTH_TIMEOUT) \
WLAN_EVENT(WLAN_EVENT_ASSOC_TIMEOUT) \
WLAN_EVENT(WLAN_EVENT_CONNECT_FAILED) \
WLAN_EVENT(WLAN_EVENT_CONNECTION_LOSS) \
WLAN_EVENT(WLAN_EVENT_AUTH_FAILED) \
WLAN_EVENT(WLAN_EVENT_ASSOC_FAILED) \
WLAN_EVENT(WLAN_EVENT_DEV_HANG) \
WLAN_EVENT(WLAN_EVENT_AP_STA_CONNECTED) \
WLAN_EVENT(WLAN_EVENT_AP_STA_DISCONNECTED) \
WLAN_EVENT(WLAN_EVENT_REKEY_COMPLETE) \
WLAN_EVENT(WLAN_EVENT_FW_CMD_TIMEOUT) \
WLAN_EVENT(WLAN_EVENT_FW_STARTUP_DONE) \
WLAN_EVENT(WLAN_EVENT_MAX) \

◆ GENERATE_ENUM

#define GENERATE_ENUM (   ENUM)    ENUM,

◆ GENERATE_STRING

#define GENERATE_STRING (   STRING)    #STRING,

◆ WIFI_STA_SM_PRIMARY_GET

#define WIFI_STA_SM_PRIMARY_GET (   a)    ((uint16_t)((a)))

◆ WIFI_STA_SM_PRIMARY_SET

#define WIFI_STA_SM_PRIMARY_SET (   a,
 
)
Value:
do { \
const char *a_sm_str = WIFI_STA_SM_STRINGS[(a)]; \
const char *b_sm_str = WIFI_STA_SM_STRINGS[(b)]; \
LOG_DBG("(%d)STA_SM: current[%s], next[%s]", __LINE__, a_sm_str, b_sm_str); \
(a) = (b); \
} while(0)
const char * WIFI_STA_SM_STRINGS[]
Definition: csk_wifi.c:65

Typedef Documentation

◆ wifi_fsm_t

Enumeration Type Documentation

◆ csk_wifi_mode_t

Enumerator
CSK_WIFI_MODE_STA 
CSK_WIFI_MODE_AP 
CSK_WIFI_MODE_MAX 

◆ wifi_cmd_t

enum wifi_cmd_t
Enumerator
WIFI_CMD_INIT 
WIFI_CMD_DEINIT 
WIFI_CMD_STA_INIT 
WIFI_CMD_STA_CONNECT 
WIFI_CMD_STA_DISCONNECT 
WIFI_CMD_AP_INIT 
WIFI_CMD_AP_START 
WIFI_CMD_AP_STOP 
WIFI_CMD_SCAN 

◆ wifi_sta_state_machine_t

Enumerator
WIFI_SM_ON_STARTUP 

WIFI_SM_STA_ON_AUTH_EXCEPTION

  1. auth timeout --> auth failed --> disconnected
  2. auth failed --> disconnected
  3. auth failed --> handshake failed --> disconnected WIFI_SM_STA_ON_ASSOC_EXCEPTION
  1. assoc failed --> auth failed --> disconnected WIFI_SM_STA_ON_HANDSHAKE_EXCEPTION

handshake err --> disconnected WIFI_SM_ON_CMDTIMEOUT_EXCEPTION

  1. cmd timeout --> disconnected
WIFI_SM_STARTUP_DONE 
WIFI_SM_STA_CONNECTED 
WIFI_SM_STA_DISCONNECTED 
WIFI_SM_STA_ON_CONNECT 
WIFI_SM_STA_ON_CONNECT_SCAN 
WIFI_SM_STA_ON_AUTH_EXCEPTION 
WIFI_SM_STA_ON_ASSOC_EXCEPTION 
WIFI_SM_STA_ON_HANDSHAKE_EXCEPTION 
WIFI_SM_ON_CMDTIMEOUT_EXCEPTION 
WIFI_SM_STA_ON_DISCONNECT 
WIFI_SM_STA_ON_SCAN 
WIFI_SM_STA_SCAN_DONE 

Function Documentation

◆ wifi_dispatch_callbacks()

void wifi_dispatch_callbacks ( csk_wifi_event_t  events,
void event_data,
uint32_t  event_data_len 
)

◆ wifi_obj_get_dev()

const struct device * wifi_obj_get_dev ( csk_wifi_mode_t  mode)

◆ wifi_send_command()

int wifi_send_command ( const struct device dev,
wifi_cmd_t  command,
k_timeout_t  timeouts 
)

◆ wifi_take_result()

int wifi_take_result ( wifi_ret_msg_t ret_msg,
k_timeout_t  timeout 
)

Variable Documentation

◆ WIFI_STA_SM_STRINGS

const char* WIFI_STA_SM_STRINGS[]
extern