Revert "add debug message"

This reverts commit 99967e9f9b.
This commit is contained in:
lr 2024-05-23 15:54:34 +08:00
parent 99967e9f9b
commit 8c0b51161e
2 changed files with 220 additions and 210 deletions

View File

@ -81,6 +81,7 @@ segments. */
timeouts. */
#define MEMP_NUM_SYS_TIMEOUT 6
/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
#define PBUF_POOL_SIZE 45
@ -110,19 +111,23 @@ as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
/* TCP receive window. */
#define TCP_WND (11*TCP_MSS)
/* ---------- ICMP options ---------- */
#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
/* ---------- UDP options ---------- */
#define LWIP_UDP 1
#define UDP_TTL 255
/* ---------- Statistics options ---------- */
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1
@ -208,7 +213,7 @@ turning this on does currently not work. */
#define DEFAULT_ACCEPTMBOX_SIZE 10
#define DEFAULT_THREAD_STACKSIZE 1024
#define TCPIP_THREAD_NAME "tcpip"
#define TCPIP_THREAD_NAME "lwip"
#define TCPIP_THREAD_STACKSIZE 512
#define TCPIP_MBOX_SIZE 8
#define TCPIP_THREAD_PRIO 3

View File

@ -25,8 +25,8 @@
#include <lwip/sys.h>
#if !NO_SYS
#include "libserial.h"
#include "sys_arch.h"
#include "libserial.h"
#include "usyscall.h"
#endif
@ -51,6 +51,7 @@ u32_t sys_now(void)
return 1;
}
sys_prot_t sys_arch_protect(void)
{
return 1;
@ -64,10 +65,12 @@ void sys_arch_unprotect(sys_prot_t pval)
err_t sys_sem_new(sys_sem_t* sem, u8_t count)
{
struct Session sem_session;
sem_t semaphore;
connect_session(&sem->sess, sem_server_name, 4096);
sem_create(&sem->sess, &semaphore, (int)count);
connect_session(&sem_session, sem_server_name, 4096);
sem_create(&sem_session, &semaphore, (int)count);
sem->sem = semaphore;
sem->sess = sem_session;
#if SYS_STATS
++lwip_stats.sys.sem.used;
if (lwip_stats.sys.sem.max < lwip_stats.sys.sem.used) {
@ -113,9 +116,8 @@ u32_t sys_arch_sem_wait(sys_sem_t* sem, u32_t timeout)
if (sem->sem < 0)
return SYS_ARCH_TIMEOUT;
printf("%s wait %d, %d\n", __func__, sem->sem, __LINE__);
sem_wait(&sem->sess, &sem->sem, 0);
printf("%s, %d\n", __func__, __LINE__);
return 0;
}
@ -138,19 +140,14 @@ void sys_mutex_set_invalid(sys_mutex_t* mutex)
{
sys_sem_set_invalid(mutex);
}
void sys_mutex_lock(sys_mutex_t* mutex)
{
printf("%s(mtx: %d)\n", __func__, *mutex);
sys_arch_sem_wait(mutex, 0);
printf("%s(mtx: %d), return\n", __func__, *mutex);
}
void sys_mutex_unlock(sys_mutex_t* mutex)
{
printf("%s(mtx: %d)\n", __func__, *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)
@ -306,7 +303,8 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t* q, void** msg, u32_t timeout)
if (msg != NULL) {
printf("sys_mbox_fetch: mbox %p msg %p\n", (void *)q, *msg);
*msg = q->msgs[q->first % SYS_MBOX_SIZE];
} else {
}
else{
printf("sys_mbox_fetch: mbox %p, null msg\n", (void *)q);
}
@ -335,7 +333,8 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t* q, void** msg)
if (msg != NULL) {
printf("sys_mbox_tryfetch: mbox %p msg %p\n", (void *)q, *msg);
*msg = q->msgs[q->first % SYS_MBOX_SIZE];
} else {
}
else{
printf("sys_mbox_tryfetch: mbox %p, null msg\n", (void *)q);
}
@ -383,10 +382,13 @@ int lwip_config_tcp(char* ip, char* mask, char* gw)
/* Registers the default network interface */
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 */
netif_set_up(&gnetif);
} else {
}
else
{
/* When the netif link is down this function must be called */
netif_set_down(&gnetif);
return -1;
@ -404,3 +406,6 @@ int lwip_config_tcp(char* ip, char* mask, char* gw)
return 0;
#endif
}