add debug message

This commit is contained in:
lr 2024-05-23 15:50:37 +08:00
parent 2147d92121
commit 99967e9f9b
2 changed files with 210 additions and 220 deletions

View File

@ -1,222 +1,217 @@
/* /*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science. * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, * 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
*/ */
#ifndef LWIP_LWIPOPTS_H #ifndef LWIP_LWIPOPTS_H
#define LWIP_LWIPOPTS_H #define LWIP_LWIPOPTS_H
/** /**
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
* critical regions during buffer allocation, deallocation and memory * critical regions during buffer allocation, deallocation and memory
* allocation and deallocation. * allocation and deallocation.
*/ */
#define SYS_LIGHTWEIGHT_PROT 1 #define SYS_LIGHTWEIGHT_PROT 1
/** /**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise, * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities. * use lwIP facilities.
*/ */
#define NO_SYS 0 #define NO_SYS 0
/** /**
* NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1 * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1
* Mainly for compatibility to old versions. * Mainly for compatibility to old versions.
*/ */
#define NO_SYS_NO_TIMERS 0 #define NO_SYS_NO_TIMERS 0
/* ---------- Memory options ---------- */ /* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
byte alignment -> define MEM_ALIGNMENT to 2. */ byte alignment -> define MEM_ALIGNMENT to 2. */
#define MEM_ALIGNMENT 4 #define MEM_ALIGNMENT 4
/* MEM_SIZE: the size of the heap memory. If the application will send /* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */ a lot of data that needs to be copied, this should be set high. */
#define MEM_SIZE (15*1024) #define MEM_SIZE (15 * 1024)
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
sends a lot of data out of ROM (or other static memory), this sends a lot of data out of ROM (or other static memory), this
should be set high. */ should be set high. */
#define MEMP_NUM_PBUF 25 #define MEMP_NUM_PBUF 25
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
per active UDP "connection". */ per active UDP "connection". */
#define MEMP_NUM_UDP_PCB 4 #define MEMP_NUM_UDP_PCB 4
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
connections. */ connections. */
#define MEMP_NUM_TCP_PCB 6 #define MEMP_NUM_TCP_PCB 6
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
connections. */ connections. */
#define MEMP_NUM_TCP_PCB_LISTEN 6 #define MEMP_NUM_TCP_PCB_LISTEN 6
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
segments. */ segments. */
#define MEMP_NUM_TCP_SEG 150 #define MEMP_NUM_TCP_SEG 150
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
timeouts. */ timeouts. */
#define MEMP_NUM_SYS_TIMEOUT 6 #define MEMP_NUM_SYS_TIMEOUT 6
/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
#define PBUF_POOL_SIZE 45
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE \
LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN)
/* ---------- Pbuf options ---------- */ /* ---------- TCP options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ #define LWIP_TCP 1
#define PBUF_POOL_SIZE 45 #define TCP_TTL 255
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE \
LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
/* ---------- TCP options ---------- */ /* Controls if TCP should queue segments that arrive out of
#define LWIP_TCP 1 order. Define to 0 if your device is low on memory. */
#define TCP_TTL 255 #define TCP_QUEUE_OOSEQ 0
/* Controls if TCP should queue segments that arrive out of /* TCP Maximum segment size. */
order. Define to 0 if your device is low on memory. */ #define TCP_MSS (1500 - 40)
#define TCP_QUEUE_OOSEQ 0
/* TCP Maximum segment size. */ /* TCP sender buffer space (bytes). */
#define TCP_MSS (1500 - 40) #define TCP_SND_BUF (10 * TCP_MSS)
/* TCP sender buffer space (bytes). */ /* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
#define TCP_SND_BUF (10*TCP_MSS) as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least #define TCP_SND_QUEUELEN (8 * TCP_SND_BUF / TCP_MSS)
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
#define TCP_SND_QUEUELEN (8* TCP_SND_BUF/TCP_MSS) /* TCP receive window. */
#define TCP_WND (11 * TCP_MSS)
/* TCP receive window. */ /* ---------- ICMP options ---------- */
#define TCP_WND (11*TCP_MSS) #define LWIP_ICMP 1
/* ---------- DHCP options ---------- */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
turning this on does currently not work. */
#define LWIP_DHCP 1
/* ---------- ICMP options ---------- */ /* ---------- UDP options ---------- */
#define LWIP_ICMP 1 #define LWIP_UDP 1
#define UDP_TTL 255
/* ---------- Statistics options ---------- */
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1
/* ---------- DHCP options ---------- */ /* ---------- link callback options ---------- */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of /* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
turning this on does currently not work. */
#define LWIP_DHCP 1
/* ---------- UDP options ---------- */
#define LWIP_UDP 1
#define UDP_TTL 255
/* ---------- Statistics options ---------- */
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1
/* ---------- link callback options ---------- */
/* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
* whenever the link changes (i.e., link down) * whenever the link changes (i.e., link down)
*/ */
#define LWIP_NETIF_LINK_CALLBACK 0 #define LWIP_NETIF_LINK_CALLBACK 0
/* /*
-------------------------------------- --------------------------------------
---------- Checksum options ---------- ---------- Checksum options ----------
-------------------------------------- --------------------------------------
*/ */
/* The STM32F4x7 allows computing and verifying the IP, /* The STM32F4x7 allows computing and verifying the IP,
UDP, TCP and ICMP checksums by hardware: UDP, TCP and ICMP checksums by hardware:
- To use this feature let the following define uncommented. - To use this feature let the following define uncommented.
- To disable it and process by CPU comment the the checksum. - To disable it and process by CPU comment the the checksum.
*/ */
#define CHECKSUM_BY_HARDWARE #define CHECKSUM_BY_HARDWARE
#ifdef CHECKSUM_BY_HARDWARE #ifdef CHECKSUM_BY_HARDWARE
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/ /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 0 #define CHECKSUM_GEN_IP 0
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/ /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 0 #define CHECKSUM_GEN_UDP 0
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/ /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 0 #define CHECKSUM_GEN_TCP 0
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/ /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 0 #define CHECKSUM_CHECK_IP 0
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/ /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 0 #define CHECKSUM_CHECK_UDP 0
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/ /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 0 #define CHECKSUM_CHECK_TCP 0
/*CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/ /*CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
#define CHECKSUM_GEN_ICMP 0 #define CHECKSUM_GEN_ICMP 0
#else #else
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/ /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 1 #define CHECKSUM_GEN_IP 1
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/ /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 1 #define CHECKSUM_GEN_UDP 1
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/ /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 1 #define CHECKSUM_GEN_TCP 1
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/ /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 1 #define CHECKSUM_CHECK_IP 1
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/ /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 1 #define CHECKSUM_CHECK_UDP 1
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/ /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 1 #define CHECKSUM_CHECK_TCP 1
/*CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/ /*CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
#define CHECKSUM_GEN_ICMP 1 #define CHECKSUM_GEN_ICMP 1
#endif #endif
/* /*
---------------------------------------------- ----------------------------------------------
---------- Sequential layer options ---------- ---------- Sequential layer options ----------
---------------------------------------------- ----------------------------------------------
*/ */
/** /**
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
*/ */
#define LWIP_NETCONN 1 #define LWIP_NETCONN 1
/* /*
------------------------------------ ------------------------------------
---------- Socket options ---------- ---------- Socket options ----------
------------------------------------ ------------------------------------
*/ */
/** /**
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
*/ */
#define LWIP_SOCKET 1 #define LWIP_SOCKET 1
/* /*
--------------------------------- ---------------------------------
---------- OS options ---------- ---------- OS options ----------
--------------------------------- ---------------------------------
*/ */
#define DEFAULT_UDP_RECVMBOX_SIZE 10 #define DEFAULT_UDP_RECVMBOX_SIZE 10
#define DEFAULT_TCP_RECVMBOX_SIZE 10 #define DEFAULT_TCP_RECVMBOX_SIZE 10
#define DEFAULT_ACCEPTMBOX_SIZE 10 #define DEFAULT_ACCEPTMBOX_SIZE 10
#define DEFAULT_THREAD_STACKSIZE 1024 #define DEFAULT_THREAD_STACKSIZE 1024
#define TCPIP_THREAD_NAME "lwip" #define TCPIP_THREAD_NAME "tcpip"
#define TCPIP_THREAD_STACKSIZE 512 #define TCPIP_THREAD_STACKSIZE 512
#define TCPIP_MBOX_SIZE 8 #define TCPIP_MBOX_SIZE 8
#define TCPIP_THREAD_PRIO 3 #define TCPIP_THREAD_PRIO 3
/* /*
---------------------------------------- ----------------------------------------

View File

@ -25,8 +25,8 @@
#include <lwip/sys.h> #include <lwip/sys.h>
#if !NO_SYS #if !NO_SYS
#include "sys_arch.h"
#include "libserial.h" #include "libserial.h"
#include "sys_arch.h"
#include "usyscall.h" #include "usyscall.h"
#endif #endif
@ -51,7 +51,6 @@ u32_t sys_now(void)
return 1; return 1;
} }
sys_prot_t sys_arch_protect(void) sys_prot_t sys_arch_protect(void)
{ {
return 1; return 1;
@ -65,13 +64,11 @@ void sys_arch_unprotect(sys_prot_t pval)
err_t sys_sem_new(sys_sem_t* sem, u8_t count) err_t sys_sem_new(sys_sem_t* sem, u8_t count)
{ {
struct Session sem_session;
sem_t semaphore; sem_t semaphore;
connect_session(&sem_session, sem_server_name, 4096); connect_session(&sem->sess, sem_server_name, 4096);
sem_create(&sem_session, &semaphore, (int)count); sem_create(&sem->sess, &semaphore, (int)count);
sem->sem = semaphore; sem->sem = semaphore;
sem->sess = sem_session; #if SYS_STATS
#if SYS_STATS
++lwip_stats.sys.sem.used; ++lwip_stats.sys.sem.used;
if (lwip_stats.sys.sem.max < lwip_stats.sys.sem.used) { if (lwip_stats.sys.sem.max < lwip_stats.sys.sem.used) {
lwip_stats.sys.sem.max = lwip_stats.sys.sem.used; lwip_stats.sys.sem.max = lwip_stats.sys.sem.used;
@ -116,8 +113,9 @@ u32_t sys_arch_sem_wait(sys_sem_t* sem, u32_t timeout)
if (sem->sem < 0) if (sem->sem < 0)
return SYS_ARCH_TIMEOUT; return SYS_ARCH_TIMEOUT;
printf("%s wait %d, %d\n", __func__, sem->sem, __LINE__);
sem_wait(&sem->sess, &sem->sem, 0); sem_wait(&sem->sess, &sem->sem, 0);
printf("%s, %d\n", __func__, __LINE__);
return 0; return 0;
} }
@ -140,14 +138,19 @@ void sys_mutex_set_invalid(sys_mutex_t* mutex)
{ {
sys_sem_set_invalid(mutex); sys_sem_set_invalid(mutex);
} }
void sys_mutex_lock(sys_mutex_t* mutex) void sys_mutex_lock(sys_mutex_t* mutex)
{ {
printf("%s(mtx: %d)\n", __func__, *mutex);
sys_arch_sem_wait(mutex, 0); sys_arch_sem_wait(mutex, 0);
printf("%s(mtx: %d), return\n", __func__, *mutex);
} }
void sys_mutex_unlock(sys_mutex_t* mutex) void sys_mutex_unlock(sys_mutex_t* mutex)
{ {
printf("%s(mtx: %d)\n", __func__, *mutex);
sys_sem_signal(mutex); sys_sem_signal(mutex);
printf("%s(mtx: %d), return\n", __func__, *mutex);
} }
sys_thread_t sys_thread_new(const char* name, lwip_thread_fn function, void* arg, int stacksize, int prio) sys_thread_t sys_thread_new(const char* name, lwip_thread_fn function, void* arg, int stacksize, int prio)
@ -193,7 +196,7 @@ err_t sys_mbox_new(sys_mbox_t* mbox, int size)
} }
void sys_mbox_free(sys_mbox_t* mbox) void sys_mbox_free(sys_mbox_t* mbox)
{ {
if (mbox != SYS_MBOX_NULL){ if (mbox != SYS_MBOX_NULL) {
sys_arch_sem_wait(mbox->mutex, 0); sys_arch_sem_wait(mbox->mutex, 0);
sys_sem_free(mbox->not_empty); sys_sem_free(mbox->not_empty);
sys_sem_free(mbox->not_full); sys_sem_free(mbox->not_full);
@ -222,7 +225,7 @@ void sys_mbox_post(sys_mbox_t* q, void* msg)
sys_arch_sem_wait(q->mutex, 0); sys_arch_sem_wait(q->mutex, 0);
printf("sys_mbox_post: mbox %p msg %p\n", (void *)q, (void *)msg); printf("sys_mbox_post: mbox %p msg %p\n", (void*)q, (void*)msg);
while ((q->last + 1) >= (q->first + SYS_MBOX_SIZE)) { while ((q->last + 1) >= (q->first + SYS_MBOX_SIZE)) {
q->wait_send++; q->wait_send++;
@ -256,7 +259,7 @@ err_t sys_mbox_trypost(sys_mbox_t* q, void* msg)
sys_arch_sem_wait(q->mutex, 0); sys_arch_sem_wait(q->mutex, 0);
printf("sys_mbox_trypost: mbox %p msg %p\n",(void *)q, (void *)msg); printf("sys_mbox_trypost: mbox %p msg %p\n", (void*)q, (void*)msg);
if ((q->last + 1) >= (q->first + SYS_MBOX_SIZE)) { if ((q->last + 1) >= (q->first + SYS_MBOX_SIZE)) {
sys_sem_signal(q->mutex); sys_sem_signal(q->mutex);
@ -301,11 +304,10 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t* q, void** msg, u32_t timeout)
} }
if (msg != NULL) { if (msg != NULL) {
printf("sys_mbox_fetch: mbox %p msg %p\n", (void *)q, *msg); printf("sys_mbox_fetch: mbox %p msg %p\n", (void*)q, *msg);
*msg = q->msgs[q->first % SYS_MBOX_SIZE]; *msg = q->msgs[q->first % SYS_MBOX_SIZE];
} } else {
else{ printf("sys_mbox_fetch: mbox %p, null msg\n", (void*)q);
printf("sys_mbox_fetch: mbox %p, null msg\n", (void *)q);
} }
q->first++; q->first++;
@ -331,11 +333,10 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t* q, void** msg)
} }
if (msg != NULL) { if (msg != NULL) {
printf("sys_mbox_tryfetch: mbox %p msg %p\n", (void *)q, *msg); printf("sys_mbox_tryfetch: mbox %p msg %p\n", (void*)q, *msg);
*msg = q->msgs[q->first % SYS_MBOX_SIZE]; *msg = q->msgs[q->first % SYS_MBOX_SIZE];
} } else {
else{ printf("sys_mbox_tryfetch: mbox %p, null msg\n", (void*)q);
printf("sys_mbox_tryfetch: mbox %p, null msg\n", (void *)q);
} }
q->first++; q->first++;
@ -382,13 +383,10 @@ int lwip_config_tcp(char* ip, char* mask, char* gw)
/* Registers the default network interface */ /* Registers the default network interface */
netif_set_default(&gnetif); netif_set_default(&gnetif);
if (netif_is_link_up(&gnetif)) if (netif_is_link_up(&gnetif)) {
{
/*When the netif is fully configured this function must be called */ /*When the netif is fully configured this function must be called */
netif_set_up(&gnetif); netif_set_up(&gnetif);
} } else {
else
{
/* When the netif link is down this function must be called */ /* When the netif link is down this function must be called */
netif_set_down(&gnetif); netif_set_down(&gnetif);
return -1; return -1;
@ -406,6 +404,3 @@ int lwip_config_tcp(char* ip, char* mask, char* gw)
return 0; return 0;
#endif #endif
} }