mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-02 12:52:10 +00:00
tcpip.c: Initialize tcpip's mbox, and verify if initialized in tcpip_input, tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with network interfaces. Also fix a compiler warning.
This commit is contained in:
parent
b290f0442d
commit
713e89cdb2
@ -67,6 +67,11 @@ HISTORY
|
|||||||
|
|
||||||
++ Bug fixes:
|
++ Bug fixes:
|
||||||
|
|
||||||
|
2007-03-20 Frédéric Bernon
|
||||||
|
* tcpip.c: Initialize tcpip's mbox, and verify if initialized in tcpip_input,
|
||||||
|
tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with
|
||||||
|
network interfaces. Also fix a compiler warning.
|
||||||
|
|
||||||
2007-03-20 Kieran Mansley
|
2007-03-20 Kieran Mansley
|
||||||
* udp.c: Only try and use pbuf_header() to make space for headers if
|
* udp.c: Only try and use pbuf_header() to make space for headers if
|
||||||
not a ROM or REF pbuf.
|
not a ROM or REF pbuf.
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
#include "lwip/igmp.h"
|
#include "lwip/igmp.h"
|
||||||
|
|
||||||
static void (* tcpip_init_done)(void *arg) = NULL;
|
static void (* tcpip_init_done)(void *arg) = NULL;
|
||||||
static void *tcpip_init_done_arg;
|
static void *tcpip_init_done_arg = NULL;
|
||||||
static sys_mbox_t mbox;
|
static sys_mbox_t mbox = SYS_MBOX_NULL;
|
||||||
|
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
static int tcpip_tcp_timer_active = 0;
|
static int tcpip_tcp_timer_active = 0;
|
||||||
@ -138,7 +138,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
|||||||
etharp_ip_input( netif, p);
|
etharp_ip_input( netif, p);
|
||||||
#endif
|
#endif
|
||||||
/* skip Ethernet header */
|
/* skip Ethernet header */
|
||||||
pbuf_header(p, -sizeof(struct eth_hdr));
|
pbuf_header(p, (s16_t)(-sizeof(struct eth_hdr)));
|
||||||
/* pass to IP layer */
|
/* pass to IP layer */
|
||||||
ip_input(p, netif);
|
ip_input(p, netif);
|
||||||
break;
|
break;
|
||||||
@ -216,6 +216,7 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
|||||||
{
|
{
|
||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
@ -228,6 +229,8 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
|||||||
sys_mbox_post(mbox, msg);
|
sys_mbox_post(mbox, msg);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
return ERR_VAL;
|
||||||
|
}
|
||||||
#endif /* ETHARP_TCPIP_INPUT */
|
#endif /* ETHARP_TCPIP_INPUT */
|
||||||
|
|
||||||
#if ETHARP_TCPIP_ETHINPUT
|
#if ETHARP_TCPIP_ETHINPUT
|
||||||
@ -236,6 +239,7 @@ tcpip_ethinput(struct pbuf *p, struct netif *inp)
|
|||||||
{
|
{
|
||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
@ -248,6 +252,8 @@ tcpip_ethinput(struct pbuf *p, struct netif *inp)
|
|||||||
sys_mbox_post(mbox, msg);
|
sys_mbox_post(mbox, msg);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
return ERR_VAL;
|
||||||
|
}
|
||||||
#endif /* ETHARP_TCPIP_ETHINPUT */
|
#endif /* ETHARP_TCPIP_ETHINPUT */
|
||||||
|
|
||||||
err_t
|
err_t
|
||||||
@ -255,6 +261,7 @@ tcpip_callback(void (*f)(void *ctx), void *ctx)
|
|||||||
{
|
{
|
||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
@ -266,11 +273,15 @@ tcpip_callback(void (*f)(void *ctx), void *ctx)
|
|||||||
sys_mbox_post(mbox, msg);
|
sys_mbox_post(mbox, msg);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
return ERR_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
err_t
|
err_t
|
||||||
tcpip_apimsg(struct api_msg *apimsg)
|
tcpip_apimsg(struct api_msg *apimsg)
|
||||||
{
|
{
|
||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
@ -280,6 +291,8 @@ tcpip_apimsg(struct api_msg *apimsg)
|
|||||||
sys_mbox_post(mbox, msg);
|
sys_mbox_post(mbox, msg);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
return ERR_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tcpip_init(void (* initfunc)(void *), void *arg)
|
tcpip_init(void (* initfunc)(void *), void *arg)
|
||||||
@ -298,6 +311,3 @@ tcpip_init(void (* initfunc)(void *), void *arg)
|
|||||||
sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
|
sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user