mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-16 07:09:58 +00:00
Fixed compiling api with LWIP_NETCONN_SEM_PER_THREAD==1 && LWIP_MPU_COMPATIBLE==1
This commit is contained in:
parent
365f3fb651
commit
fc1db87318
@ -867,7 +867,7 @@ netconn_gethostbyname(const char *name, ip_addr_t *addr)
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
tcpip_callback(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg));
|
||||
sys_sem_wait(API_EXPR_REF(API_VAR_REF(msg).sem));
|
||||
sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem));
|
||||
#if !LWIP_NETCONN_SEM_PER_THREAD
|
||||
sys_sem_free(API_EXPR_REF(API_VAR_REF(msg).sem));
|
||||
#endif /* !LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
@ -1827,7 +1827,7 @@ lwip_netconn_do_dns_found(const char *name, const ip_addr_t *ipaddr, void *arg)
|
||||
API_EXPR_DEREF(msg->addr) = *ipaddr;
|
||||
}
|
||||
/* wake up the application task waiting in netconn_gethostbyname */
|
||||
sys_sem_signal(API_EXPR_REF(msg->sem));
|
||||
sys_sem_signal(API_EXPR_REF_SEM(msg->sem));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1852,7 +1852,7 @@ lwip_netconn_do_gethostbyname(void *arg)
|
||||
if (API_EXPR_DEREF(msg->err) != ERR_INPROGRESS) {
|
||||
/* on error or immediate success, wake up the application
|
||||
* task waiting in netconn_gethostbyname */
|
||||
sys_sem_signal(API_EXPR_REF(msg->sem));
|
||||
sys_sem_signal(API_EXPR_REF_SEM(msg->sem));
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_DNS */
|
||||
|
@ -1841,7 +1841,12 @@ lwip_getsockopt_callback(void *arg)
|
||||
LWIP_ASSERT("arg != NULL", arg != NULL);
|
||||
data = (struct lwip_setgetsockopt_data*)arg;
|
||||
|
||||
data->err = lwip_getsockopt_impl(data->s, data->level, data->optname, data->optval.p,
|
||||
data->err = lwip_getsockopt_impl(data->s, data->level, data->optname,
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
data->optval,
|
||||
#else /* LWIP_MPU_COMPATIBLE */
|
||||
data->optval.p,
|
||||
#endif /* LWIP_MPU_COMPATIBLE */
|
||||
&data->optlen);
|
||||
|
||||
sys_sem_signal((sys_sem_t*)(data->completed_sem));
|
||||
@ -2233,7 +2238,12 @@ lwip_setsockopt_callback(void *arg)
|
||||
LWIP_ASSERT("arg != NULL", arg != NULL);
|
||||
data = (struct lwip_setgetsockopt_data*)arg;
|
||||
|
||||
data->err = lwip_setsockopt_impl(data->s, data->level, data->optname, data->optval.pc,
|
||||
data->err = lwip_setsockopt_impl(data->s, data->level, data->optname,
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
data->optval,
|
||||
#else /* LWIP_MPU_COMPATIBLE */
|
||||
data->optval.pc,
|
||||
#endif /* LWIP_MPU_COMPATIBLE */
|
||||
data->optlen);
|
||||
|
||||
sys_sem_signal((sys_sem_t*)(data->completed_sem));
|
||||
|
@ -58,9 +58,15 @@ extern "C" {
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
#define API_MSG_M_DEF(m) m
|
||||
#define API_MSG_M_DEF_C(t, m) t m
|
||||
#ifdef LWIP_NETCONN_SEM_PER_THREAD
|
||||
#define API_MSG_M_DEF_SEM(m) *m
|
||||
#else
|
||||
#define API_MSG_M_DEF_SEM(m) API_MSG_M_DEF(m)
|
||||
#endif
|
||||
#else /* LWIP_MPU_COMPATIBLE */
|
||||
#define API_MSG_M_DEF(m) *m
|
||||
#define API_MSG_M_DEF_C(t, m) const t * m
|
||||
#define API_MSG_M_DEF_SEM(m) API_MSG_M_DEF(m)
|
||||
#endif /* LWIP_MPU_COMPATIBLE */
|
||||
|
||||
/* For the netconn API, these values are use as a bitmask! */
|
||||
@ -177,7 +183,7 @@ struct dns_api_msg {
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
/** This semaphore is posted when the name is resolved, the application thread
|
||||
should wait on it. */
|
||||
sys_sem_t API_MSG_M_DEF(sem);
|
||||
sys_sem_t API_MSG_M_DEF_SEM(sem);
|
||||
/** Errors are given back here */
|
||||
err_t API_MSG_M_DEF(err);
|
||||
};
|
||||
|
@ -114,6 +114,11 @@ extern sys_mutex_t lock_tcpip_core;
|
||||
} while(0)
|
||||
#define API_VAR_FREE(pool, name) memp_free(pool, name)
|
||||
#define API_EXPR_REF(expr) &(expr)
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
#define API_EXPR_REF_SEM(expr) (expr)
|
||||
#else
|
||||
#define API_EXPR_REF_SEM(expr) API_EXPR_REF(expr)
|
||||
#endif
|
||||
#define API_EXPR_DEREF(expr) expr
|
||||
#else /* LWIP_MPU_COMPATIBLE */
|
||||
#define API_VAR_REF(name) name
|
||||
@ -122,6 +127,7 @@ extern sys_mutex_t lock_tcpip_core;
|
||||
#define API_VAR_ALLOC_DONTFAIL(type, pool, name)
|
||||
#define API_VAR_FREE(pool, name)
|
||||
#define API_EXPR_REF(expr) expr
|
||||
#define API_EXPR_REF_SEM(expr) API_EXPR_REF(expr)
|
||||
#define API_EXPR_DEREF(expr) *(expr)
|
||||
#endif /* LWIP_MPU_COMPATIBLE */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user