esp-open-rtos/open_esplibs/libnet80211/ieee80211_sta.c
Our Air Quality 3c81f7d587 lwip update
* The mdns responder has been reworked to lower stack and memory usage. This is
  a variation on the upstream code, it use malloc whereas the upstream code uses
  pools. The high stack usage of the mdns responder was problem for
  esp-open-rtos, so we might have to maintain the differences for now.

* Improved lwip core locking, and lock checking. Upstream improvements, that
  need some added support from esp-open-rtos specific code. More core lock is
  performed when calling from the esp-open-rtos code now, so a little safer. The
  checking is not enforced, but projects might see warning messages and might
  want to look into them.

* The esp-open-rtos lwip support has been sync'ed with the new freertos port
  included with lwip. There are still some minor differences.

* A few lwip timer bugs have been resolved. This might help resolve some issues.

* Plus it picks up all the other upstream fixes and improvements.

* The default lwip stack has been lowered from 768 words to 480 words,
  due to the reduced stack usage by the mdns responder.
2018-02-09 20:26:02 +11:00

74 lines
2.1 KiB
C

/* Recreated Espressif libnet80211 ieee80211_sta.o contents.
Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
BSD Licensed as described in the file LICENSE
*/
#include <string.h>
#include "esplibs/libmain.h"
#include "esplibs/libnet80211.h"
#include "esplibs/libpp.h"
#include "esplibs/libwpa.h"
#include "tcpip.h"
#include "espressif/esp_sta.h"
void sdk_sta_status_set(int status) {
struct sdk_g_ic_netif_info *netif_info = sdk_g_ic.v.station_netif_info;
uint32_t statusb8 = netif_info->statusb8;
if (statusb8 == 1 || statusb8 == status) {
uint32_t statusb9 = netif_info->statusb9 + 1;
netif_info->statusb9 = statusb9;
if (statusb9 == 3)
netif_info->connect_status = status;
} else {
netif_info->statusb9 = 0;
netif_info->connect_status = 1;
}
netif_info->statusb8 = status;
return;
}
bool sdk_wifi_station_start() {
struct sdk_g_ic_netif_info *netif_info = sdk_g_ic.v.station_netif_info;
if (!netif_info)
return 0;
if (!netif_info->started) {
if (!netif_info->netif) {
struct netif *netif = (struct netif *)malloc(sizeof(struct netif));
netif_info->netif = netif;
memcpy(&netif->hwaddr, &sdk_info.sta_mac_addr, 6);
LOCK_TCPIP_CORE();
netif_add(netif, &sdk_info.sta_ipaddr, &sdk_info.sta_netmask,
&sdk_info.sta_gw, netif_info, ethernetif_init, tcpip_input);
UNLOCK_TCPIP_CORE();
sdk_wpa_attach(&sdk_g_ic);
}
sdk_ic_set_vif(0, 1, &sdk_info.sta_mac_addr, 0, 0);
netif_info->statusb8 = 0;
netif_info->statusb9 = 0;
netif_info->started = 1;
}
return 1;
}
bool sdk_wifi_station_stop() {
struct sdk_g_ic_netif_info *netif_info = sdk_g_ic.v.station_netif_info;
if (!netif_info)
return 0;
if (netif_info->started) {
netif_info->statusb8 = 0;
netif_info->statusb9 = 0;
sdk_wifi_station_disconnect();
sdk_ic_set_vif(0, 0, NULL, 0, 0);
netif_info->started = 0;
}
return 1;
}