mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components: lwip/tcpip_adapter/freertos/esp32
Replace os_printf with printf
This commit is contained in:
parent
cb3d46786d
commit
dcc998c92f
@ -28,26 +28,10 @@
|
||||
#define ESP32_WORKAROUND 1
|
||||
|
||||
#if CONFIG_WIFI_ENABLED
|
||||
|
||||
#ifdef ESP32_WORKAROUND
|
||||
|
||||
extern SemaphoreHandle_t stdio_mutex_tx;
|
||||
#define os_printf(fmt, ...) do {\
|
||||
if (!stdio_mutex_tx) {\
|
||||
stdio_mutex_tx = xSemaphoreCreateMutex();\
|
||||
}\
|
||||
\
|
||||
xSemaphoreTake(stdio_mutex_tx, portMAX_DELAY);\
|
||||
ets_printf(fmt, ##__VA_ARGS__);\
|
||||
xSemaphoreGive(stdio_mutex_tx);\
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
static xQueueHandle g_event_handler = NULL;
|
||||
static system_event_cb_t g_event_handler_cb;
|
||||
|
||||
#define WIFI_DEBUG os_printf
|
||||
#define WIFI_DEBUG printf
|
||||
#define WIFI_API_CALL_CHECK(info, api_call, ret) \
|
||||
do{\
|
||||
esp_err_t __err = (api_call);\
|
||||
@ -159,40 +143,40 @@ static esp_err_t esp_wifi_post_event_to_user(system_event_t *event)
|
||||
static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
{
|
||||
if (event == NULL) {
|
||||
os_printf("Error: event is null!\n");
|
||||
printf("Error: event is null!\n");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
os_printf("received event: ");
|
||||
printf("received event: ");
|
||||
switch (event->event_id) {
|
||||
case SYSTEM_EVENT_WIFI_READY:
|
||||
{
|
||||
os_printf("SYSTEM_EVENT_WIFI_READY\n");
|
||||
printf("SYSTEM_EVENT_WIFI_READY\n");
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_SCAN_DONE:
|
||||
{
|
||||
system_event_sta_scan_done_t *scan_done;
|
||||
scan_done = &event->event_info.scan_done;
|
||||
os_printf("SYSTEM_EVENT_SCAN_DONE\nstatus:%d, number:%d\n", \
|
||||
printf("SYSTEM_EVENT_SCAN_DONE\nstatus:%d, number:%d\n", \
|
||||
scan_done->status, scan_done->number);
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_STA_START:
|
||||
{
|
||||
os_printf("SYSTEM_EVENT_STA_START\n");
|
||||
printf("SYSTEM_EVENT_STA_START\n");
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_STA_STOP:
|
||||
{
|
||||
os_printf("SYSTEM_EVENT_STA_STOP\n");
|
||||
printf("SYSTEM_EVENT_STA_STOP\n");
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_STA_CONNECTED:
|
||||
{
|
||||
system_event_sta_connected_t *connected;
|
||||
connected = &event->event_info.connected;
|
||||
os_printf("SYSTEM_EVENT_STA_CONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d\n", \
|
||||
printf("SYSTEM_EVENT_STA_CONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, channel:%d\n", \
|
||||
connected->ssid, connected->ssid_len, connected->bssid[0], connected->bssid[0], connected->bssid[1], \
|
||||
connected->bssid[3], connected->bssid[4], connected->bssid[5], connected->channel);
|
||||
break;
|
||||
@ -201,7 +185,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
{
|
||||
system_event_sta_disconnected_t *disconnected;
|
||||
disconnected = &event->event_info.disconnected;
|
||||
os_printf("SYSTEM_EVENT_STA_DISCONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d\n", \
|
||||
printf("SYSTEM_EVENT_STA_DISCONNECTED\nssid:%s, ssid_len:%d, bssid:%02x:%02x:%02x:%02x:%02x:%02x, reason:%d\n", \
|
||||
disconnected->ssid, disconnected->ssid_len, disconnected->bssid[0], disconnected->bssid[0], disconnected->bssid[1], \
|
||||
disconnected->bssid[3], disconnected->bssid[4], disconnected->bssid[5], disconnected->reason);
|
||||
break;
|
||||
@ -210,31 +194,31 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
{
|
||||
system_event_sta_authmode_change_t *auth_change;
|
||||
auth_change = &event->event_info.auth_change;
|
||||
os_printf("SYSTEM_EVENT_STA_AUTHMODE_CHNAGE\nold_mode:%d, new_mode:%d\n", auth_change->old_mode, auth_change->new_mode);
|
||||
printf("SYSTEM_EVENT_STA_AUTHMODE_CHNAGE\nold_mode:%d, new_mode:%d\n", auth_change->old_mode, auth_change->new_mode);
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_STA_GOTIP:
|
||||
{
|
||||
system_event_sta_gotip_t *got_ip;
|
||||
got_ip = &event->event_info.got_ip;
|
||||
os_printf("SYSTEM_EVENT_STA_GOTIP\n");
|
||||
printf("SYSTEM_EVENT_STA_GOTIP\n");
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_AP_START:
|
||||
{
|
||||
os_printf("SYSTEM_EVENT_AP_START\n");
|
||||
printf("SYSTEM_EVENT_AP_START\n");
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_AP_STOP:
|
||||
{
|
||||
os_printf("SYSTEM_EVENT_AP_STOP\n");
|
||||
printf("SYSTEM_EVENT_AP_STOP\n");
|
||||
break;
|
||||
}
|
||||
case SYSTEM_EVENT_AP_STACONNECTED:
|
||||
{
|
||||
system_event_ap_staconnected_t *staconnected;
|
||||
staconnected = &event->event_info.sta_connected;
|
||||
os_printf("SYSTEM_EVENT_AP_STACONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \
|
||||
printf("SYSTEM_EVENT_AP_STACONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \
|
||||
staconnected->mac[0], staconnected->mac[0], staconnected->mac[1], \
|
||||
staconnected->mac[3], staconnected->mac[4], staconnected->mac[5], staconnected->aid);
|
||||
break;
|
||||
@ -243,7 +227,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
{
|
||||
system_event_ap_stadisconnected_t *stadisconnected;
|
||||
stadisconnected = &event->event_info.sta_disconnected;
|
||||
os_printf("SYSTEM_EVENT_AP_STADISCONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \
|
||||
printf("SYSTEM_EVENT_AP_STADISCONNECTED\nmac:%02x:%02x:%02x:%02x:%02x:%02x, aid:%d\n", \
|
||||
stadisconnected->mac[0], stadisconnected->mac[0], stadisconnected->mac[1], \
|
||||
stadisconnected->mac[3], stadisconnected->mac[4], stadisconnected->mac[5], stadisconnected->aid);
|
||||
break;
|
||||
@ -252,14 +236,14 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
{
|
||||
system_event_ap_probe_req_rx_t *ap_probereqrecved;
|
||||
ap_probereqrecved = &event->event_info.ap_probereqrecved;
|
||||
os_printf("SYSTEM_EVENT_AP_PROBEREQRECVED\nrssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x\n", \
|
||||
printf("SYSTEM_EVENT_AP_PROBEREQRECVED\nrssi:%d, mac:%02x:%02x:%02x:%02x:%02x:%02x\n", \
|
||||
ap_probereqrecved->rssi, ap_probereqrecved->mac[0], ap_probereqrecved->mac[0], ap_probereqrecved->mac[1], \
|
||||
ap_probereqrecved->mac[3], ap_probereqrecved->mac[4], ap_probereqrecved->mac[5]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
os_printf("Error: no such kind of event!\n");
|
||||
printf("Error: no such kind of event!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -270,19 +254,19 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
static esp_err_t esp_system_event_handler(system_event_t *event)
|
||||
{
|
||||
if (event == NULL) {
|
||||
os_printf("Error: event is null!\n");
|
||||
printf("Error: event is null!\n");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_system_event_debug(event);
|
||||
if ((event->event_id < SYSTEM_EVENT_MAX) && (event->event_id == g_system_event_handle_table[event->event_id].event_id)){
|
||||
if (g_system_event_handle_table[event->event_id].event_handle){
|
||||
os_printf("enter default callback\n");
|
||||
printf("enter default callback\n");
|
||||
g_system_event_handle_table[event->event_id].event_handle(event);
|
||||
os_printf("exit default callback\n");
|
||||
printf("exit default callback\n");
|
||||
}
|
||||
} else {
|
||||
os_printf("mismatch or invalid event, id=%d\n", event->event_id);
|
||||
printf("mismatch or invalid event, id=%d\n", event->event_id);
|
||||
}
|
||||
|
||||
return esp_wifi_post_event_to_user(event);
|
||||
@ -297,7 +281,7 @@ static void esp_system_event_task(void *pvParameters)
|
||||
if (xQueueReceive(g_event_handler, &evt, portMAX_DELAY) == pdPASS) {
|
||||
ret = esp_system_event_handler(&evt);
|
||||
if (ret == ESP_FAIL)
|
||||
os_printf("esp wifi post event to user fail!\n");
|
||||
printf("esp wifi post event to user fail!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 40dc7af7f3d8da6745476e66cbd65be9b8988f6c
|
||||
Subproject commit 7c8bd4ec5a3e099768b15372fcb98959d6617e92
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi.h"
|
||||
@ -23,30 +24,11 @@
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
//#include "tcpip_adapter.h"
|
||||
|
||||
#define ESP32_WORKAROUND 1
|
||||
|
||||
#if CONFIG_WIFI_ENABLED
|
||||
|
||||
#ifdef ESP32_WORKAROUND
|
||||
|
||||
SemaphoreHandle_t stdio_mutex_tx = NULL;
|
||||
#define os_printf(fmt, ...) do {\
|
||||
if (!stdio_mutex_tx) {\
|
||||
stdio_mutex_tx = xSemaphoreCreateMutex();\
|
||||
}\
|
||||
\
|
||||
xSemaphoreTake(stdio_mutex_tx, portMAX_DELAY);\
|
||||
ets_printf(fmt, ##__VA_ARGS__);\
|
||||
xSemaphoreGive(stdio_mutex_tx);\
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
static wifi_startup_cb_t startup_cb;
|
||||
|
||||
#define WIFI_DEBUG os_printf
|
||||
#define WIFI_DEBUG printf
|
||||
#define WIFI_API_CALL_CHECK(info, api_call, ret) \
|
||||
do{\
|
||||
esp_err_t __err = (api_call);\
|
||||
|
@ -35,7 +35,7 @@ overflow handler also is in here.
|
||||
*/
|
||||
|
||||
#if !CONFIG_FREERTOS_PANIC_SILENT_REBOOT
|
||||
//os_printf may be broken, so we fix our own printing fns...
|
||||
//printf may be broken, so we fix our own printing fns...
|
||||
inline static void panicPutchar(char c) {
|
||||
while (((READ_PERI_REG(UART_STATUS_REG(0))>>UART_TXFIFO_CNT_S)&UART_TXFIFO_CNT)>=126) ;
|
||||
WRITE_PERI_REG(UART_FIFO_REG(0), c);
|
||||
|
@ -69,7 +69,7 @@ enum dyc_dhcps_flags{
|
||||
#define DHCPS_DEBUG 0
|
||||
#define DHCPS_LOG printf
|
||||
|
||||
#define DYC_DHCP_CRASH //os_printf
|
||||
#define DYC_DHCP_CRASH //printf
|
||||
|
||||
|
||||
#define MAX_STATION_NUM 8
|
||||
@ -376,7 +376,7 @@ u32_t magic_cookie_temp = magic_cookie;
|
||||
|
||||
//extern bool system_get_string_from_flash(void *flash_str, void* ram_str,uint8 ram_str_len);
|
||||
//system_get_string_from_flash((void *)(&magic_cookie), (void *)(&magic_cookie_temp),4);
|
||||
//os_printf("ck_tmp3:%08X\n",magic_cookie_temp);
|
||||
//printf("ck_tmp3:%08X\n",magic_cookie_temp);
|
||||
|
||||
//memcpy((char *) m->options, &magic_cookie, sizeof(magic_cookie));
|
||||
memcpy((char *) m->options, &magic_cookie_temp, sizeof(magic_cookie_temp));
|
||||
@ -698,7 +698,7 @@ static s16_t parse_msg(struct dhcps_msg *m, u16_t len)
|
||||
//u32 magic_cookie_temp = magic_cookie;
|
||||
//extern bool system_get_string_from_flash(void *flash_str, void* ram_str,uint8 ram_str_len);
|
||||
//system_get_string_from_flash((void *)(&magic_cookie), (void *)(&magic_cookie_temp),4);
|
||||
//os_printf("ck_tmp4:%08X\n",magic_cookie_temp);
|
||||
//printf("ck_tmp4:%08X\n",magic_cookie_temp);
|
||||
|
||||
if(memcmp((char *)m->options,
|
||||
&magic_cookie,
|
||||
@ -726,7 +726,7 @@ static s16_t parse_msg(struct dhcps_msg *m, u16_t len)
|
||||
for (pback_node = plist; pback_node != NULL;pback_node = pback_node->pnext) {
|
||||
pdhcps_pool = pback_node->pnode;
|
||||
if (memcmp(pdhcps_pool->mac, m->chaddr, sizeof(pdhcps_pool->mac)) == 0){
|
||||
// os_printf("the same device request ip\n");
|
||||
// printf("the same device request ip\n");
|
||||
if (memcmp(&pdhcps_pool->ip.addr, m->ciaddr, sizeof(pdhcps_pool->ip.addr)) == 0) {
|
||||
renew = true;
|
||||
}
|
||||
@ -736,7 +736,7 @@ static s16_t parse_msg(struct dhcps_msg *m, u16_t len)
|
||||
goto POOL_CHECK;
|
||||
} else if (pdhcps_pool->ip.addr == client_address_plus.addr){
|
||||
// client_address.addr = client_address_plus.addr;
|
||||
// os_printf("the ip addr has been request\n");
|
||||
// printf("the ip addr has been request\n");
|
||||
addr_tmp.addr = htonl(client_address_plus.addr);
|
||||
addr_tmp.addr++;
|
||||
client_address_plus.addr = htonl(addr_tmp.addr);
|
||||
@ -967,7 +967,7 @@ static void wifi_softap_init_dhcps_lease(u32_t ip)
|
||||
dhcps_lease.start_ip.addr = htonl(dhcps_lease.start_ip.addr);
|
||||
dhcps_lease.end_ip.addr= htonl(dhcps_lease.end_ip.addr);
|
||||
}
|
||||
// os_printf("start_ip = 0x%x, end_ip = 0x%x\n",dhcps_lease.start_ip, dhcps_lease.end_ip);
|
||||
// printf("start_ip = 0x%x, end_ip = 0x%x\n",dhcps_lease.start_ip, dhcps_lease.end_ip);
|
||||
}
|
||||
|
||||
|
||||
|
@ -459,7 +459,7 @@ dhcp_fine_tmr(void)
|
||||
#if 0
|
||||
if (DHCP_MAXRTX != 0) {
|
||||
if (netif->dhcp->tries >= DHCP_MAXRTX){
|
||||
//os_printf("DHCP timeout\n");
|
||||
//printf("DHCP timeout\n");
|
||||
if (netif->dhcp_event != NULL)
|
||||
netif->dhcp_event();
|
||||
break;
|
||||
|
@ -88,8 +88,8 @@ bool dhcp_search_ip_on_mac(u8_t *mac, ip4_addr_t *ip);
|
||||
#define DHCPS_DEBUG 1
|
||||
#if DHCPS_DEBUG
|
||||
#define log_info(message, ...) do { \
|
||||
os_printf((message), ##__VA_ARGS__); \
|
||||
os_printf("\n"); \
|
||||
printf((message), ##__VA_ARGS__); \
|
||||
printf("\n"); \
|
||||
} while(0);
|
||||
|
||||
#else
|
||||
|
@ -505,7 +505,7 @@ int lwip_fcntl(int s, int cmd, int val);
|
||||
#if LWIP_COMPAT_SOCKETS
|
||||
#if LWIP_COMPAT_SOCKETS != 2
|
||||
|
||||
#ifdef LWIP_THREAD_SAFE
|
||||
#if LWIP_THREAD_SAFE
|
||||
|
||||
int lwip_accept_r(int s, struct sockaddr *addr, socklen_t *addrlen);
|
||||
int lwip_bind_r(int s, const struct sockaddr *name, socklen_t namelen);
|
||||
|
@ -65,21 +65,7 @@ typedef int sys_prot_t;
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
|
||||
#if 1//def ESP32_WORKAROUND
|
||||
extern SemaphoreHandle_t stdio_mutex_tx;
|
||||
#define LWIP_PLATFORM_DIAG(message)\
|
||||
do{\
|
||||
if (!stdio_mutex_tx) {\
|
||||
stdio_mutex_tx = xSemaphoreCreateMutex();\
|
||||
}\
|
||||
\
|
||||
xSemaphoreTake(stdio_mutex_tx, portMAX_DELAY);\
|
||||
ets_printf message;\
|
||||
xSemaphoreGive(stdio_mutex_tx);\
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
|
||||
#define LWIP_PLATFORM_ASSERT(x) do {printf(x); sys_arch_assert(__FILE__, __LINE__);} while(0)
|
||||
|
||||
//#define LWIP_DEBUG
|
||||
|
@ -222,7 +222,6 @@ extern unsigned long os_random(void);
|
||||
* (2 * TCP_MSS) for things to work well
|
||||
*/
|
||||
#ifdef PERF
|
||||
|
||||
extern unsigned char misc_prof_get_tcpw(void);
|
||||
extern unsigned char misc_prof_get_tcp_snd_buf(void);
|
||||
#define TCP_WND (misc_prof_get_tcpw()*TCP_MSS)
|
||||
@ -470,7 +469,7 @@ extern unsigned char misc_prof_get_tcp_snd_buf(void);
|
||||
/**
|
||||
* SOCKETS_DEBUG: Enable debugging in sockets.c.
|
||||
*/
|
||||
#define SOCKETS_DEBUG LWIP_DBG_OFF
|
||||
#define SOCKETS_DEBUG LWIP_DBG_ON
|
||||
|
||||
/**
|
||||
* ICMP_DEBUG: Enable debugging in icmp.c.
|
||||
|
@ -38,7 +38,7 @@ static tcpip_adapter_dhcp_status_t dhcpc_status = TCPIP_ADAPTER_DHCP_INIT;
|
||||
|
||||
static esp_err_t tcpip_adapter_addr_change_cb(struct netif *netif);
|
||||
|
||||
#define TCPIP_ADAPTER_DEBUG ets_printf
|
||||
#define TCPIP_ADAPTER_DEBUG printf
|
||||
|
||||
void tcpip_adapter_init(void)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user