1 /*
2  * Copyright (c) 2018, Texas Instruments Incorporated
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  */
7 
8 #ifndef ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_SUPPORT_H_
9 #define ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_SUPPORT_H_
10 
11 #include <zephyr/net/wifi_mgmt.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #define SSID_LEN_MAX	 (32)
18 #define BSSID_LEN_MAX	 (6)
19 
20 /* Define ID for simplelink_wifi_cb to not conflict with WLAN event IDs: */
21 #define SIMPLELINK_WIFI_CB_IPACQUIRED \
22 		(SL_WLAN_EVENT_MAX + SL_NETAPP_EVENT_IPV4_ACQUIRED)
23 #define SIMPLELINK_WIFI_CB_IPV6ACQUIRED \
24 		(SL_WLAN_EVENT_MAX + SL_NETAPP_EVENT_IPV6_ACQUIRED)
25 
26 struct sl_connect_state {
27 	uint32_t gateway_ip;
28 	uint8_t ssid[SSID_LEN_MAX + 1];
29 	uint8_t bssid[BSSID_LEN_MAX];
30 	uint32_t ip_addr;
31 	uint32_t sta_ip;
32 	uint32_t ipv6_addr[4];
33 	int16_t error;
34 };
35 
36 /* Callback from SimpleLink Event Handlers: */
37 typedef void (*simplelink_wifi_cb_t)(uint32_t mgmt_event,
38 				     struct sl_connect_state *conn);
39 
40 extern int z_simplelink_start_scan(void);
41 extern void z_simplelink_get_scan_result(int index,
42 					struct wifi_scan_result *scan_result);
43 extern void z_simplelink_get_mac(unsigned char *mac);
44 extern int z_simplelink_init(simplelink_wifi_cb_t wifi_cb);
45 extern int z_simplelink_connect(struct wifi_connect_req_params *params);
46 extern int z_simplelink_disconnect(void);
47 
48 int simplelink_socket_create(int family, int type, int proto);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 /**
55  * @}
56  */
57 
58 #endif /* ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_SUPPORT_H_ */
59