feat(log): add esp_log to internal wifi lib

This commit is contained in:
Zhang Jun Hao
2019-01-28 15:03:51 +08:00
parent 54d31061c1
commit 965fc47ff8
8 changed files with 289 additions and 2 deletions

View File

@ -24,6 +24,36 @@ typedef enum {
WIFI_RX_PBUF_DRAM, /** save rx buffer to dram and upload to tcpip */
} wifi_rx_pbuf_mem_type_t;
/**
* @brief WiFi log level
*
*/
typedef enum {
WIFI_LOG_ERROR = 0, /*enabled by default*/
WIFI_LOG_WARNING, /*can be set in menuconfig*/
WIFI_LOG_INFO, /*can be set in menuconfig*/
WIFI_LOG_DEBUG, /*can be set in menuconfig*/
WIFI_LOG_VERBOSE, /*can be set in menuconfig*/
} wifi_log_level_t;
/**
* @brief WiFi log submodule definition
*
*/
#define WIFI_LOG_SUBMODULE_NULL (0)
#define WIFI_LOG_SUBMODULE_CORE (1<<0)
#define WIFI_LOG_SUBMODULE_SCAN (1<<1)
#define WIFI_LOG_SUBMODULE_PM (1<<2)
#define WIFI_LOG_SUBMODULE_NVS (1<<3)
#define WIFI_LOG_SUBMODULE_TRC (1<<4)
#define WIFI_LOG_SUBMODULE_EBUF (1<<5)
#define WIFI_LOG_SUBMODULE_NET80211 (1<<6)
#define WIFI_LOG_SUBMODULE_TIMER (1<<7)
#define WIFI_LOG_SUBMODULE_ESPNOW (1<<8)
#define WIFI_LOG_SUBMODULE_MAC (1<<9)
#define WIFI_LOG_SUBMODULE_WPA (1<<10)
#define WIFI_LOG_SUBMODULE_WPS (1<<11)
/**
* @brief Set WIFI received TCP/IP data cache ram type
*
@ -106,6 +136,41 @@ typedef esp_err_t (*wifi_rxcb_t)(void *buffer, uint16_t len, void *eb);
*/
esp_err_t esp_wifi_internal_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn);
/**
* @brief Set current WiFi log level
*
* @param level Log level.
*
* @return
* - ESP_OK: succeed
* - ESP_FAIL: level is invalid
*/
esp_err_t esp_wifi_internal_set_log_level(wifi_log_level_t level);
/**
* @brief Set current log module and submodule
*
* @param module Log module
* @param submodule Log submodule
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_ARG: invalid argument
*/
esp_err_t esp_wifi_internal_set_log_mod(uint32_t submodule);
/**
* @brief Get current WiFi log info
*
* @param log_level the return log level.
* @param log_mod the return log module and submodule
*
* @return
* - ESP_OK: succeed
*/
esp_err_t esp_wifi_internal_get_log(wifi_log_level_t *log_level, uint32_t *log_mod);
#ifdef __cplusplus
}
#endif