feat: Remove the use of os_printf in SDK

This commit is contained in:
Wu Jian Gang
2018-05-24 19:52:43 +08:00
parent c7e5bb4a39
commit 291c94b501
17 changed files with 144 additions and 144 deletions

View File

@ -122,7 +122,7 @@ void hw_test_timer_cb(void)
if ((WDEV_NOW() - tick_now2) >= 1000000) {
static uint32_t idx = 1;
tick_now2 = WDEV_NOW();
os_printf("b%u:%d\n", idx++, j);
printf("b%u:%d\n", idx++, j);
j = 0;
}

View File

@ -258,9 +258,9 @@ void IRAM_ATTR vPortExitCritical(void)
void ShowCritical(void)
{
os_printf("ShowCritical:%u\n", uxCriticalNesting);
os_printf("HdlMacSig:%u\n", HdlMacSig);
os_printf("SWReq:%u\n", SWReq);
printf("ShowCritical:%u\n", uxCriticalNesting);
printf("HdlMacSig:%u\n", HdlMacSig);
printf("SWReq:%u\n", SWReq);
ets_delay_us(50000);
}
@ -343,7 +343,7 @@ int xPortInIsrContext(void)
void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName)
{
os_printf("task [%s] stask overflow\n", pcTaskName);
printf("task [%s] stask overflow\n", pcTaskName);
}
void IRAM_ATTR __taskEXIT_CRITICAL(void)

View File

@ -313,15 +313,15 @@ static void send_offer(struct dhcps_msg* m)
p = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct dhcps_msg), PBUF_RAM);
#if DHCPS_DEBUG
os_printf("udhcp: send_offer>>p->ref = %d\n", p->ref);
printf("udhcp: send_offer>>p->ref = %d\n", p->ref);
#endif
if (p != NULL) {
#if DHCPS_DEBUG
os_printf("dhcps: send_offer>>pbuf_alloc succeed\n");
os_printf("dhcps: send_offer>>p->tot_len = %d\n", p->tot_len);
os_printf("dhcps: send_offer>>p->len = %d\n", p->len);
printf("dhcps: send_offer>>pbuf_alloc succeed\n");
printf("dhcps: send_offer>>p->tot_len = %d\n", p->tot_len);
printf("dhcps: send_offer>>p->len = %d\n", p->len);
#endif
q = p;
@ -331,10 +331,10 @@ static void send_offer(struct dhcps_msg* m)
for (i = 0; i < q->len; i++) {
data[i] = ((u8_t*) m)[cnt++];
#if DHCPS_DEBUG
os_printf("%02x ", data[i]);
printf("%02x ", data[i]);
if ((i + 1) % 16 == 0) {
os_printf("\n");
printf("\n");
}
#endif
@ -345,21 +345,21 @@ static void send_offer(struct dhcps_msg* m)
} else {
#if DHCPS_DEBUG
os_printf("dhcps: send_offer>>pbuf_alloc failed\n");
printf("dhcps: send_offer>>pbuf_alloc failed\n");
#endif
return;
}
#if DHCPS_DEBUG
SendOffer_err_t = udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
os_printf("dhcps: send_offer>>udp_sendto result %x\n", SendOffer_err_t);
printf("dhcps: send_offer>>udp_sendto result %x\n", SendOffer_err_t);
#else
udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
#endif
if (p->ref != 0) {
#if DHCPS_DEBUG
os_printf("udhcp: send_offer>>free pbuf\n");
printf("udhcp: send_offer>>free pbuf\n");
#endif
pbuf_free(p);
}
@ -389,15 +389,15 @@ static void send_nak(struct dhcps_msg* m)
p = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct dhcps_msg), PBUF_RAM);
#if DHCPS_DEBUG
os_printf("udhcp: send_nak>>p->ref = %d\n", p->ref);
printf("udhcp: send_nak>>p->ref = %d\n", p->ref);
#endif
if (p != NULL) {
#if DHCPS_DEBUG
os_printf("dhcps: send_nak>>pbuf_alloc succeed\n");
os_printf("dhcps: send_nak>>p->tot_len = %d\n", p->tot_len);
os_printf("dhcps: send_nak>>p->len = %d\n", p->len);
printf("dhcps: send_nak>>pbuf_alloc succeed\n");
printf("dhcps: send_nak>>p->tot_len = %d\n", p->tot_len);
printf("dhcps: send_nak>>p->len = %d\n", p->len);
#endif
q = p;
@ -407,10 +407,10 @@ static void send_nak(struct dhcps_msg* m)
for (i = 0; i < q->len; i++) {
data[i] = ((u8_t*) m)[cnt++];
#if DHCPS_DEBUG
os_printf("%02x ", data[i]);
printf("%02x ", data[i]);
if ((i + 1) % 16 == 0) {
os_printf("\n");
printf("\n");
}
#endif
@ -421,21 +421,21 @@ static void send_nak(struct dhcps_msg* m)
} else {
#if DHCPS_DEBUG
os_printf("dhcps: send_nak>>pbuf_alloc failed\n");
printf("dhcps: send_nak>>pbuf_alloc failed\n");
#endif
return;
}
#if DHCPS_DEBUG
SendNak_err_t = udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
os_printf("dhcps: send_nak>>udp_sendto result %x\n", SendNak_err_t);
printf("dhcps: send_nak>>udp_sendto result %x\n", SendNak_err_t);
#else
udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
#endif
if (p->ref != 0) {
#if DHCPS_DEBUG
os_printf("udhcp: send_nak>>free pbuf\n");
printf("udhcp: send_nak>>free pbuf\n");
#endif
pbuf_free(p);
}
@ -466,15 +466,15 @@ static void send_ack(struct dhcps_msg* m)
p = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct dhcps_msg), PBUF_RAM);
#if DHCPS_DEBUG
os_printf("udhcp: send_ack>>p->ref = %d\n", p->ref);
printf("udhcp: send_ack>>p->ref = %d\n", p->ref);
#endif
if (p != NULL) {
#if DHCPS_DEBUG
os_printf("dhcps: send_ack>>pbuf_alloc succeed\n");
os_printf("dhcps: send_ack>>p->tot_len = %d\n", p->tot_len);
os_printf("dhcps: send_ack>>p->len = %d\n", p->len);
printf("dhcps: send_ack>>pbuf_alloc succeed\n");
printf("dhcps: send_ack>>p->tot_len = %d\n", p->tot_len);
printf("dhcps: send_ack>>p->len = %d\n", p->len);
#endif
q = p;
@ -484,10 +484,10 @@ static void send_ack(struct dhcps_msg* m)
for (i = 0; i < q->len; i++) {
data[i] = ((u8_t*) m)[cnt++];
#if DHCPS_DEBUG
os_printf("%02x ", data[i]);
printf("%02x ", data[i]);
if ((i + 1) % 16 == 0) {
os_printf("\n");
printf("\n");
}
#endif
@ -498,21 +498,21 @@ static void send_ack(struct dhcps_msg* m)
} else {
#if DHCPS_DEBUG
os_printf("dhcps: send_ack>>pbuf_alloc failed\n");
printf("dhcps: send_ack>>pbuf_alloc failed\n");
#endif
return;
}
#if DHCPS_DEBUG
SendAck_err_t = udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
os_printf("dhcps: send_ack>>udp_sendto result %x\n", SendAck_err_t);
printf("dhcps: send_ack>>udp_sendto result %x\n", SendAck_err_t);
#else
udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
#endif
if (p->ref != 0) {
#if DHCPS_DEBUG
os_printf("udhcp: send_ack>>free pbuf\n");
printf("udhcp: send_ack>>free pbuf\n");
#endif
pbuf_free(p);
}
@ -542,7 +542,7 @@ static u8_t parse_options(u8_t* optptr, s16_t len)
while (optptr < end) {
#if DHCPS_DEBUG
os_printf("dhcps: (s16_t)*optptr = %d\n", (s16_t)*optptr);
printf("dhcps: (s16_t)*optptr = %d\n", (s16_t)*optptr);
#endif
switch ((s16_t) *optptr) {
@ -554,12 +554,12 @@ static u8_t parse_options(u8_t* optptr, s16_t len)
case DHCP_OPTION_REQ_IPADDR://50
if (memcmp((char*) &client.addr, (char*) optptr + 2, 4) == 0) {
#if DHCPS_DEBUG
os_printf("dhcps: DHCP_OPTION_REQ_IPADDR = 0 ok\n");
printf("dhcps: DHCP_OPTION_REQ_IPADDR = 0 ok\n");
#endif
s.state = DHCPS_STATE_ACK;
} else {
#if DHCPS_DEBUG
os_printf("dhcps: DHCP_OPTION_REQ_IPADDR != 0 err\n");
printf("dhcps: DHCP_OPTION_REQ_IPADDR != 0 err\n");
#endif
s.state = DHCPS_STATE_NAK;
}
@ -584,7 +584,7 @@ static u8_t parse_options(u8_t* optptr, s16_t len)
case DHCPDISCOVER://1
s.state = DHCPS_STATE_OFFER;
#if DHCPS_DEBUG
os_printf("dhcps: DHCPD_STATE_OFFER\n");
printf("dhcps: DHCPD_STATE_OFFER\n");
#endif
break;
@ -597,7 +597,7 @@ static u8_t parse_options(u8_t* optptr, s16_t len)
}
#if DHCPS_DEBUG
os_printf("dhcps: DHCPD_STATE_NAK\n");
printf("dhcps: DHCPD_STATE_NAK\n");
#endif
}
@ -606,20 +606,20 @@ static u8_t parse_options(u8_t* optptr, s16_t len)
case DHCPDECLINE://4
s.state = DHCPS_STATE_IDLE;
#if DHCPS_DEBUG
os_printf("dhcps: DHCPD_STATE_IDLE\n");
printf("dhcps: DHCPD_STATE_IDLE\n");
#endif
break;
case DHCPRELEASE://7
s.state = DHCPS_STATE_RELEASE;
#if DHCPS_DEBUG
os_printf("dhcps: DHCPD_STATE_IDLE\n");
printf("dhcps: DHCPD_STATE_IDLE\n");
#endif
break;
}
#if DHCPS_DEBUG
os_printf("dhcps: return s.state = %d\n", s.state);
printf("dhcps: return s.state = %d\n", s.state);
#endif
return s.state;
}
@ -633,7 +633,7 @@ static s16_t parse_msg(struct dhcps_msg* m, u16_t len)
&magic_cookie,
sizeof(magic_cookie)) == 0) {
#if DHCPS_DEBUG
os_printf("dhcps: len = %d\n", len);
printf("dhcps: len = %d\n", len);
#endif
/*
* <20><>¼<EFBFBD><C2BC>ǰ<EFBFBD><C7B0>xid<69><64><EFBFBD><EFBFBD><EFB4A6><EFBFBD>?
@ -682,7 +682,7 @@ static s16_t parse_msg(struct dhcps_msg* m, u16_t len)
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;
}
@ -693,7 +693,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);
@ -783,8 +783,8 @@ POOL_CHECK:
// }
#if DHCPS_DEBUG
os_printf("dhcps: xid changed\n");
os_printf("dhcps: client_address.addr = %x\n", client_address.addr);
printf("dhcps: xid changed\n");
printf("dhcps: client_address.addr = %x\n", client_address.addr);
#endif
// }
@ -821,7 +821,7 @@ static void handle_dhcp(void* arg,
u8_t* data;
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> receive a packet\n");
printf("dhcps: handle_dhcp-> receive a packet\n");
#endif
if (p == NULL) {
@ -840,17 +840,17 @@ static void handle_dhcp(void* arg,
data = p->payload;
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> p->tot_len = %d\n", tlen);
os_printf("dhcps: handle_dhcp-> p->len = %d\n", p->len);
printf("dhcps: handle_dhcp-> p->tot_len = %d\n", tlen);
printf("dhcps: handle_dhcp-> p->len = %d\n", p->len);
#endif
for (i = 0; i < p->len; i++) {
p_dhcps_msg[dhcps_msg_cnt++] = data[i];
#if DHCPS_DEBUG
os_printf("%02x ", data[i]);
printf("%02x ", data[i]);
if ((i + 1) % 16 == 0) {
os_printf("\n");
printf("\n");
}
#endif
@ -858,9 +858,9 @@ static void handle_dhcp(void* arg,
if (p->next != NULL) {
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> p->next != NULL\n");
os_printf("dhcps: handle_dhcp-> p->next->tot_len = %d\n", p->next->tot_len);
os_printf("dhcps: handle_dhcp-> p->next->len = %d\n", p->next->len);
printf("dhcps: handle_dhcp-> p->next != NULL\n");
printf("dhcps: handle_dhcp-> p->next->tot_len = %d\n", p->next->tot_len);
printf("dhcps: handle_dhcp-> p->next->len = %d\n", p->next->len);
#endif
data = p->next->payload;
@ -868,10 +868,10 @@ static void handle_dhcp(void* arg,
for (i = 0; i < p->next->len; i++) {
p_dhcps_msg[dhcps_msg_cnt++] = data[i];
#if DHCPS_DEBUG
os_printf("%02x ", data[i]);
printf("%02x ", data[i]);
if ((i + 1) % 16 == 0) {
os_printf("\n");
printf("\n");
}
#endif
@ -882,28 +882,28 @@ static void handle_dhcp(void* arg,
* DHCP <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
*/
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> parse_msg(p)\n");
printf("dhcps: handle_dhcp-> parse_msg(p)\n");
#endif
switch (parse_msg(pmsg_dhcps, tlen - 240)) {
case DHCPS_STATE_OFFER://1
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> DHCPD_STATE_OFFER\n");
printf("dhcps: handle_dhcp-> DHCPD_STATE_OFFER\n");
#endif
send_offer(pmsg_dhcps);
break;
case DHCPS_STATE_ACK://3
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> DHCPD_STATE_ACK\n");
printf("dhcps: handle_dhcp-> DHCPD_STATE_ACK\n");
#endif
send_ack(pmsg_dhcps);
break;
case DHCPS_STATE_NAK://4
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> DHCPD_STATE_NAK\n");
printf("dhcps: handle_dhcp-> DHCPD_STATE_NAK\n");
#endif
send_nak(pmsg_dhcps);
break;
@ -913,7 +913,7 @@ static void handle_dhcp(void* arg,
}
#if DHCPS_DEBUG
os_printf("dhcps: handle_dhcp-> pbuf_free(p)\n");
printf("dhcps: handle_dhcp-> pbuf_free(p)\n");
#endif
pbuf_free(p);
os_free(pmsg_dhcps);
@ -963,7 +963,7 @@ static void wifi_softap_init_dhcps_lease(u32_t ip)
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);
}
///////////////////////////////////////////////////////////////////////////////////
void dhcps_start(struct ip_info* info)
@ -975,7 +975,7 @@ void dhcps_start(struct ip_info* info)
pcb_dhcps = udp_new();
if (pcb_dhcps == NULL || info == NULL) {
os_printf("dhcps_start(): could not obtain pcb\n");
printf("dhcps_start(): could not obtain pcb\n");
}
server_address = info->ip;
@ -984,7 +984,7 @@ void dhcps_start(struct ip_info* info)
udp_bind(pcb_dhcps, IP_ADDR_ANY, DHCPS_SERVER_PORT);
udp_recv(pcb_dhcps, handle_dhcp, NULL);
#if DHCPS_DEBUG
os_printf("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps\n");
printf("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps\n");
#endif
}

View File

@ -65,7 +65,7 @@ typedef struct _sock_mt sock_mt_t;
#if (SOCK_MT_DEBUG_LEVEL < 16)
#define SOCK_MT_DEBUG(level, ...) \
if (level >= SOCK_MT_DEBUG_LEVEL) \
os_printf(__VA_ARGS__);
printf(__VA_ARGS__);
#else
#define SOCK_MT_DEBUG(level, ...)
#endif

View File

@ -416,7 +416,7 @@ sys_arch_unprotect(sys_prot_t pval)
void
sys_arch_assert(const char *file, int line)
{
os_printf("\nAssertion: %d in %s\n", line, file);
printf("\nAssertion: %d in %s\n", line, file);
while(1);
}

View File

@ -104,7 +104,7 @@ int get_file(const char *filename, uint8_t **buf)
stream = open(filename, 0x18);
if (stream < 0) {
#ifdef CONFIG_SSL_FULL_MODE
os_printf("file '%s' does not exist\n", filename);
printf("file '%s' does not exist\n", filename);
#endif
return -1;
}

View File

@ -584,7 +584,7 @@ int asn1_compare_dn(char * const dn1[], char * const dn2[])
for (i = 0; i < X509_NUM_DN_TYPES; i++)
{
#if CONFIG_SSL_DISPLAY_MODE
os_printf("distinguished names: [%s], [%s]\n", dn1[i], dn2[i]);
printf("distinguished names: [%s], [%s]\n", dn1[i], dn2[i]);
#endif
if (asn1_compare_dn_comp(dn1[i], dn2[i]))
return 1;

View File

@ -78,7 +78,7 @@ EXP_FUNC int STDCALL ssl_obj_load(SSL_CTX *ssl_ctx, int obj_type,
{
#ifdef CONFIG_SSL_HAS_PEM
#if CONFIG_SSL_DISPLAY_MODE
os_printf("the file is a PEM file.\n");
printf("the file is a PEM file.\n");
#endif
ret = ssl_obj_PEM_load(ssl_ctx, obj_type, ssl_obj, password);
#else
@ -88,7 +88,7 @@ EXP_FUNC int STDCALL ssl_obj_load(SSL_CTX *ssl_ctx, int obj_type,
}
else {
#if CONFIG_SSL_DISPLAY_MODE
os_printf("the file is not a PEM file.\n");
printf("the file is not a PEM file.\n");
#endif
ret = do_obj(ssl_ctx, obj_type, ssl_obj, password);
}

View File

@ -90,10 +90,10 @@ EXP_FUNC int STDCALL getdomainname(char *buf, int buf_size)
static const char * out_of_mem_str = "out of memory %s %d\n";
#define exit_now os_printf
#define exit_now printf
//#define SSL_LOG
#ifdef SSL_LOG
#define debug_now os_printf
#define debug_now printf
#else
#define debug_now
#endif
@ -126,7 +126,7 @@ void add(MEM_INFO alloc_info)
ptr_next = ptr_next->next;
}
if(mem_flag) {
os_printf("mem_leak_info =%p\n",mem_leak_info);
printf("mem_leak_info =%p\n",mem_leak_info);
mem_flag = 0;
report_mem_leak();
}
@ -277,20 +277,20 @@ void report_mem_leak(void)
char *info;
sys_mutex_lock(&mem_mutex);
os_printf("ptr_start =%p\n",ptr_start);
printf("ptr_start =%p\n",ptr_start);
info = (char *)zalloc(name_length);
if(info) {
for(leak_info = ptr_start; leak_info != NULL; leak_info = leak_info->next)
{
os_printf("%p\n",leak_info);
printf("%p\n",leak_info);
sprintf(info, "address : %p\n", leak_info->mem_info.address);
os_printf("%s\n",info);
printf("%s\n",info);
sprintf(info, "size : %d bytes\n", leak_info->mem_info.size);
os_printf("%s\n",info);
printf("%s\n",info);
snprintf(info,name_length,"file : %s\n", leak_info->mem_info.file_name);
os_printf("%s\n",info);
printf("%s\n",info);
sprintf(info, "line : %d\n", leak_info->mem_info.line);
os_printf("%s\n",info);
printf("%s\n",info);
}
clear();
free(info);

View File

@ -243,7 +243,7 @@ EXP_FUNC void STDCALL ssl_ctx_free(SSL_CTX *ssl_ctx)
EXP_FUNC void STDCALL ssl_free(SSL *ssl)
{
SSL_CTX *ssl_ctx;
os_printf("ssl_free:Aviable Memory|%d\n",system_get_free_heap_size());
printf("ssl_free:Aviable Memory|%d\n",system_get_free_heap_size());
if (ssl == NULL) /* just ignore null pointers */
return;
@ -1237,7 +1237,7 @@ int basic_read(SSL *ssl, uint8_t **in_data)
begain:
/* do we violate the spec with the message size? */
//os_printf("basic_read index %u\n", ssl->bm_read_index);
//printf("basic_read index %u\n", ssl->bm_read_index);
if (ssl->bm_read_index > ssl->max_fragme_length + RT_EXTRA) {
ret = SSL_ERROR_INVALID_PROT_MSG;

View File

@ -366,7 +366,7 @@ int x509_verify(const CA_CERT_CTX *ca_cert_ctx, const X509_CTX *cert)
if (asn1_compare_dn(cert->ca_cert_dn, cert->cert_dn) == 0)
{
#if CONFIG_SSL_DISPLAY_MODE
os_printf("a self-signed certificate that is not in the CA store\n");
printf("a self-signed certificate that is not in the CA store\n");
#endif
is_self_signed = 1;
ctx = cert->rsa_ctx->bi_ctx;
@ -376,7 +376,7 @@ int x509_verify(const CA_CERT_CTX *ca_cert_ctx, const X509_CTX *cert)
gettimeofday(&tv, (void*)&cert->not_before);
#if CONFIG_SSL_DISPLAY_MODE
os_printf("before %u, tv_sec %u, after %u\n",cert->not_before, tv.tv_sec, cert->not_after);
printf("before %u, tv_sec %u, after %u\n",cert->not_before, tv.tv_sec, cert->not_after);
#endif
/* check the not before date */
if (tv.tv_sec < cert->not_before)
@ -400,7 +400,7 @@ int x509_verify(const CA_CERT_CTX *ca_cert_ctx, const X509_CTX *cert)
if (ca_cert_ctx != NULL)
{
#if CONFIG_SSL_DISPLAY_MODE
os_printf("look for a trusted cert\n");
printf("look for a trusted cert\n");
#endif
/* go thu the CA store */
while (i < CONFIG_X509_MAX_CA_CERTS && ca_cert_ctx->cert[i])
@ -410,7 +410,7 @@ int x509_verify(const CA_CERT_CTX *ca_cert_ctx, const X509_CTX *cert)
{
/* use this CA certificate for signature verification */
#if CONFIG_SSL_DISPLAY_MODE
os_printf("use the CA certificate for signature verification\n");
printf("use the CA certificate for signature verification\n");
#endif
match_ca_cert = 1;
ctx = ca_cert_ctx->cert[i]->rsa_ctx->bi_ctx;
@ -461,7 +461,7 @@ int x509_verify(const CA_CERT_CTX *ca_cert_ctx, const X509_CTX *cert)
ret = X509_VFY_ERROR_BAD_SIGNATURE;
#if CONFIG_SSL_DISPLAY_MODE
os_printf("check the signature ok\n");
printf("check the signature ok\n");
#endif
// bi_free(ctx, cert_sig);//comment the line for check signature by LiuH at 20150.06.11
}

View File

@ -70,12 +70,12 @@ void wifi_event_handler_cb(System_Event_t *event)
switch (event->event_id) {
case EVENT_STAMODE_GOT_IP:
os_printf("sta got ip ,create task and free heap size is %d\n", system_get_free_heap_size());
printf("sta got ip ,create task and free heap size is %d\n", system_get_free_heap_size());
user_conn_init();
break;
case EVENT_STAMODE_CONNECTED:
os_printf("sta connected\n");
printf("sta connected\n");
break;
case EVENT_STAMODE_DISCONNECTED:
@ -95,7 +95,7 @@ void wifi_event_handler_cb(System_Event_t *event)
*******************************************************************************/
void user_init(void)
{
os_printf("SDK version:%s %d\n", system_get_sdk_version(), system_get_free_heap_size());
printf("SDK version:%s %d\n", system_get_sdk_version(), system_get_free_heap_size());
wifi_set_opmode(STATION_MODE);
struct station_config config;

View File

@ -55,90 +55,90 @@ static void openssl_demo_thread(void *p)
int recv_bytes = 0;
os_printf("OpenSSL demo thread start...\n");
printf("OpenSSL demo thread start...\n");
do {
ret = netconn_gethostbyname(OPENSSL_DEMO_TARGET_NAME, &target_ip);
} while(ret);
os_printf("get target IP is %d.%d.%d.%d\n", (unsigned char)((target_ip.u_addr.ip4.addr & 0x000000ff) >> 0),
printf("get target IP is %d.%d.%d.%d\n", (unsigned char)((target_ip.u_addr.ip4.addr & 0x000000ff) >> 0),
(unsigned char)((target_ip.u_addr.ip4.addr & 0x0000ff00) >> 8),
(unsigned char)((target_ip.u_addr.ip4.addr & 0x00ff0000) >> 16),
(unsigned char)((target_ip.u_addr.ip4.addr & 0xff000000) >> 24));
os_printf("create SSL context ......");
printf("create SSL context ......");
ctx = SSL_CTX_new(TLSv1_1_client_method());
if (!ctx) {
os_printf("failed\n");
printf("failed\n");
goto failed1;
}
os_printf("OK\n");
printf("OK\n");
os_printf("set SSL context read buffer size ......");
printf("set SSL context read buffer size ......");
SSL_CTX_set_default_read_buffer_len(ctx, OPENSSL_DEMO_FRAGMENT_SIZE);
ret = 0;
if (ret) {
os_printf("failed, return %d\n", ret);
printf("failed, return %d\n", ret);
goto failed2;
}
os_printf("OK\n");
printf("OK\n");
os_printf("create socket ......");
printf("create socket ......");
socket = socket(AF_INET, SOCK_STREAM, 0);
if (socket < 0) {
os_printf("failed\n");
printf("failed\n");
goto failed3;
}
os_printf("OK\n");
printf("OK\n");
os_printf("bind socket ......");
printf("bind socket ......");
memset(&sock_addr, 0, sizeof(sock_addr));
sock_addr.sin_family = AF_INET;
sock_addr.sin_addr.s_addr = 0;
sock_addr.sin_port = htons(OPENSSL_DEMO_LOCAL_TCP_PORT);
ret = bind(socket, (struct sockaddr*)&sock_addr, sizeof(sock_addr));
if (ret) {
os_printf("failed\n");
printf("failed\n");
goto failed4;
}
os_printf("OK\n");
printf("OK\n");
os_printf("socket connect to remote ......");
printf("socket connect to remote ......");
memset(&sock_addr, 0, sizeof(sock_addr));
sock_addr.sin_family = AF_INET;
sock_addr.sin_addr.s_addr = target_ip.u_addr.ip4.addr;
sock_addr.sin_port = htons(OPENSSL_DEMO_TARGET_TCP_PORT);
ret = connect(socket, (struct sockaddr*)&sock_addr, sizeof(sock_addr));
if (ret) {
os_printf("failed\n");
printf("failed\n");
goto failed5;
}
os_printf("OK\n");
printf("OK\n");
os_printf("create SSL ......");
printf("create SSL ......");
ssl = SSL_new(ctx);
if (!ssl) {
os_printf("failed\n");
printf("failed\n");
goto failed6;
}
os_printf("OK\n");
printf("OK\n");
SSL_set_fd(ssl, socket);
os_printf("SSL connected to %s port %d ......", OPENSSL_DEMO_TARGET_NAME, OPENSSL_DEMO_TARGET_TCP_PORT);
printf("SSL connected to %s port %d ......", OPENSSL_DEMO_TARGET_NAME, OPENSSL_DEMO_TARGET_TCP_PORT);
ret = SSL_connect(ssl);
if (!ret) {
os_printf("failed, return [-0x%x]\n", -ret);
printf("failed, return [-0x%x]\n", -ret);
goto failed7;
}
os_printf("OK\n");
printf("OK\n");
os_printf("send request to %s port %d ......", OPENSSL_DEMO_TARGET_NAME, OPENSSL_DEMO_TARGET_TCP_PORT);
printf("send request to %s port %d ......", OPENSSL_DEMO_TARGET_NAME, OPENSSL_DEMO_TARGET_TCP_PORT);
ret = SSL_write(ssl, send_data, send_bytes);
if (ret <= 0) {
os_printf("failed, return [-0x%x]\n", -ret);
printf("failed, return [-0x%x]\n", -ret);
goto failed8;
}
os_printf("OK\n\n");
printf("OK\n\n");
do {
ret = SSL_read(ssl, recv_buf, OPENSSL_DEMO_RECV_BUF_LEN - 1);
@ -146,9 +146,9 @@ static void openssl_demo_thread(void *p)
break;
}
recv_bytes += ret;
os_printf("%s", recv_buf);
printf("%s", recv_buf);
} while (1);
os_printf("read %d bytes data from %s ......\n", recv_bytes, OPENSSL_DEMO_TARGET_NAME);
printf("read %d bytes data from %s ......\n", recv_bytes, OPENSSL_DEMO_TARGET_NAME);
failed8:
SSL_shutdown(ssl);
@ -164,7 +164,7 @@ failed2:
failed1:
vTaskDelete(NULL);
os_printf("task exit\n");
printf("task exit\n");
return ;
}
@ -180,7 +180,7 @@ void user_conn_init(void)
OPENSSL_DEMO_THREAD_PRORIOTY,
&openssl_handle);
if (ret != pdPASS) {
os_printf("create thread %s failed\n", OPENSSL_DEMO_THREAD_NAME);
printf("create thread %s failed\n", OPENSSL_DEMO_THREAD_NAME);
return ;
}
}

View File

@ -70,7 +70,7 @@ void wifi_event_handler_cb(System_Event_t *event)
switch (event->event_id) {
case EVENT_STAMODE_GOT_IP:
os_printf("sta got ip , creat task %d\n", system_get_free_heap_size());
printf("sta got ip , creat task %d\n", system_get_free_heap_size());
user_conn_init();
break;
@ -87,7 +87,7 @@ void wifi_event_handler_cb(System_Event_t *event)
*******************************************************************************/
void user_init(void)
{
os_printf("SDK version:%s %d\n", system_get_sdk_version(), system_get_free_heap_size());
printf("SDK version:%s %d\n", system_get_sdk_version(), system_get_free_heap_size());
wifi_set_opmode(STATION_MODE);
// set AP parameter

View File

@ -63,15 +63,15 @@ static void airkiss_wifilan_time_callback(void)
ret = airkiss_lan_pack(AIRKISS_LAN_SSDP_NOTIFY_CMD,
DEVICE_TYPE, DEVICE_ID, 0, 0, lan_buf, &lan_buf_len, &akconf);
if (ret != AIRKISS_LAN_PAKE_READY) {
os_printf("Pack lan packet error!");
printf("Pack lan packet error!");
return;
}
ret = espconn_sendto(&pssdpudpconn, lan_buf, lan_buf_len);
if (ret != 0) {
os_printf("UDP send error!");
printf("UDP send error!");
}
os_printf("Finish send notify!\n");
printf("Finish send notify!\n");
}
static void airkiss_wifilan_recv_callbk(void *arg, char *pdata, unsigned short len)
@ -85,9 +85,9 @@ static void airkiss_wifilan_recv_callbk(void *arg, char *pdata, unsigned short l
switch (ret){
case AIRKISS_LAN_SSDP_REQ:
espconn_get_connection_info(&pssdpudpconn, &pcon_info, 0);
os_printf("remote ip: %d.%d.%d.%d \r\n",pcon_info->remote_ip[0],pcon_info->remote_ip[1],
printf("remote ip: %d.%d.%d.%d \r\n",pcon_info->remote_ip[0],pcon_info->remote_ip[1],
pcon_info->remote_ip[2],pcon_info->remote_ip[3]);
os_printf("remote port: %d \r\n",pcon_info->remote_port);
printf("remote port: %d \r\n",pcon_info->remote_port);
pssdpudpconn.proto.udp->remote_port = pcon_info->remote_port;
memcpy(pssdpudpconn.proto.udp->remote_ip,pcon_info->remote_ip,4);
@ -98,23 +98,23 @@ static void airkiss_wifilan_recv_callbk(void *arg, char *pdata, unsigned short l
DEVICE_TYPE, DEVICE_ID, 0, 0, lan_buf, &lan_buf_len, &akconf);
if (packret != AIRKISS_LAN_PAKE_READY) {
os_printf("Pack lan packet error!");
printf("Pack lan packet error!");
return;
}
os_printf("\r\n\r\n");
printf("\r\n\r\n");
for (i=0; i<lan_buf_len; i++)
os_printf("%c",lan_buf[i]);
os_printf("\r\n\r\n");
printf("%c",lan_buf[i]);
printf("\r\n\r\n");
packret = espconn_sendto(&pssdpudpconn, lan_buf, lan_buf_len);
if (packret != 0) {
os_printf("LAN UDP Send err!");
printf("LAN UDP Send err!");
}
break;
default:
os_printf("Pack is not ssdq req!%d\r\n",ret);
printf("Pack is not ssdq req!%d\r\n",ret);
break;
}
}

View File

@ -65,9 +65,9 @@ static void wait_for_connection_ready(uint8_t flag)
{
os_timer_disarm(&timer);
if(wifi_station_connected()){
os_printf("connected\n");
printf("connected\n");
} else {
os_printf("reconnect after 2s\n");
printf("reconnect after 2s\n");
os_timer_setfn(&timer, (os_timer_func_t *)wait_for_connection_ready, NULL);
os_timer_arm(&timer, 2000, 0);
}
@ -80,7 +80,7 @@ static void on_wifi_connect(){
}
static void on_wifi_disconnect(uint8_t reason){
os_printf("disconnect %d\n", reason);
printf("disconnect %d\n", reason);
}
/******************************************************************************

View File

@ -38,7 +38,7 @@ void wifi_event_handler_cb(System_Event_t *event)
return;
}
//os_printf("[WiFi] event %u\n", event->event_id);
//printf("[WiFi] event %u\n", event->event_id);
switch (event->event_id) {
case EVENT_STAMODE_DISCONNECTED:
@ -142,12 +142,12 @@ bool start_wifi_station(const char * ssid, const char * pass){
if((mode & STATION_MODE) == 0){
mode |= STATION_MODE;
if(!wifi_set_mode(mode)){
os_printf("Failed to enable Station mode!\n");
printf("Failed to enable Station mode!\n");
return false;
}
}
if(!ssid){
os_printf("No SSID Given. Will connect to the station saved in flash\n");
printf("No SSID Given. Will connect to the station saved in flash\n");
return true;
}
struct station_config config;
@ -157,14 +157,14 @@ bool start_wifi_station(const char * ssid, const char * pass){
strcpy(config.password, pass);
}
if(!wifi_station_set_config(&config)){
os_printf("Failed to set Station config!\n");
printf("Failed to set Station config!\n");
return false;
}
if(!wifi_station_dhcpc_status()){
os_printf("DHCP is not started. Starting it...\n");
printf("DHCP is not started. Starting it...\n");
if(!wifi_station_dhcpc_start()){
os_printf("DHCP start failed!\n");
printf("DHCP start failed!\n");
return false;
}
}
@ -175,7 +175,7 @@ bool stop_wifi_station(){
WIFI_MODE mode = wifi_get_opmode();
mode &= ~STATION_MODE;
if(!wifi_set_mode(mode)){
os_printf("Failed to disable Station mode!\n");
printf("Failed to disable Station mode!\n");
return false;
}
return true;
@ -186,12 +186,12 @@ bool start_wifi_ap(const char * ssid, const char * pass){
if((mode & SOFTAP_MODE) == 0){
mode |= SOFTAP_MODE;
if(!wifi_set_mode(mode)){
os_printf("Failed to enable AP mode!\n");
printf("Failed to enable AP mode!\n");
return false;
}
}
if(!ssid){
os_printf("No SSID Given. Will start the AP saved in flash\n");
printf("No SSID Given. Will start the AP saved in flash\n");
return true;
}
struct softap_config config;
@ -207,7 +207,7 @@ bool stop_wifi_ap(){
WIFI_MODE mode = wifi_get_opmode();
mode &= ~SOFTAP_MODE;
if(!wifi_set_mode(mode)){
os_printf("Failed to disable AP mode!\n");
printf("Failed to disable AP mode!\n");
return false;
}
return true;