newslwIP - A Lightweight TCP/IP stack - News: lwIP 1.2.0 has been released

 
 
Latest News
lwIP 2.0.3 released posted by goldsimon, Sat 16 Sep 2017 06:54:45 AM UTC - 0 replies
lwIP 2.0.2 released posted by goldsimon, Mon 13 Mar 2017 11:46:49 AM UTC - 0 replies
lwIP 2.0.1 released posted by goldsimon, Tue 10 Jan 2017 09:35:39 AM UTC - 0 replies
lwIP 2.0.0 released posted by goldsimon, Thu 10 Nov 2016 09:19:28 AM UTC - 0 replies
lwip 2.0.0 RC2 released posted by goldsimon, Wed 03 Aug 2016 12:04:55 PM UTC - 0 replies
[Submit News]
[43 news in archive]

lwIP 1.2.0 has been released

Item posted by Leon Woestenberg <likewise> on Tue 05 Dec 2006 10:32:25 AM UTC.

Note this release went without any release candidate cycles, so beware, test well, and report back any bugs.

Comments:

Hanging in sys_mbox_fetch function (posted by raghavendar, Tue 07 Jun 2011 11:09:44 AM UTC)

Hi All,

I am currently using lwip V1.2.0

I downloaded lwip port in ucos-ii on S3C2440 processor from internet.

In that firmware they created a new task for webserver using lwip as i described below

void T_WEBServer(void *pReserved)
{
extern void Handler_HTTP(ST_NETCONN *pstConn);
ST_NETCONN __pstConn, __pstNewConn;
InitLwIP();
SetupLwIP();
__pstConn = netconn_new(NETCONN_TCP);
netconn_bind(__pstConn, NULL, HTTP_PORT);
netconn_listen(__pstConn);

while(TRUE)
{
__pstNewConn = netconn_accept(__pstConn);

if(__pstNewConn != NULL)
{
Handler_HTTP(__pstNewConn);
while(netconn_delete(__pstNewConn) != ERR_OK)
OSTimeDlyHMSM(0, 0, 1, 0);
}
}
}

void InitLwIP(void)
{
sys_init();
mem_init();
memp_init();
pbuf_init();
netif_init();
ip_init();
tcpip_init(NULL, NULL);
udp_init();
}

void SetupLwIP(void)
{
extern err_t ethernetif_init(st_netif *stNetif);

st_ip_addr __stIpAddr, __stNetMask, __stGateway;
static st_netif __stEMACNetif;

//* ½¨Á¢²¢ÅäÖÃEMAC½Ó¿Ú
IP4_ADDR(&__stIpAddr, 192,168,1,11);

IP4_ADDR(&__stNetMask, 255,255,255,0);
IP4_ADDR(&__stGateway,192,168,1,1);

netif_add(&__stEMACNetif, &__stIpAddr, &__stNetMask, &__stGateway, NULL, ethernetif_init, tcpip_input);

netif_set_default(&__stEMACNetif);
netif_set_up(&__stEMACNetif);
}

My probelm is in sys.c file i.e. sys_mbox_fetch(sys_mbox_t mbox, void **msg) function, my code is hanging for eever in that function, here i am copying that function.

void
sys_mbox_fetch(sys_mbox_t mbox, void **msg)
{
u32_t time;
struct sys_timeouts *timeouts;
struct sys_timeout *tmptimeout;
sys_timeout_handler h;
void *arg;

again:
timeouts = sys_arch_timeouts();

if (!timeouts || !timeouts->next) {
sys_arch_mbox_fetch(mbox, msg, 0); // --->in this function my code is hanging
} else {
if (timeouts->next->time > 0) {
time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time);
} else {
time = SYS_ARCH_TIMEOUT;
}

if (time == SYS_ARCH_TIMEOUT) {
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
could be fetched. We should now call the timeout handler and
deallocate the memory allocated for the timeout. */
tmptimeout = timeouts->next;
timeouts->next = tmptimeout->next;
h = tmptimeout->h;
arg = tmptimeout->arg;
memp_free(MEMP_SYS_TIMEOUT, tmptimeout);
if (h != NULL) {
LWIP_DEBUGF(SYS_DEBUG, ("smf calling h=%p(%p)\n", (void )h, (void )arg));
h(arg);
}

/* We try again to fetch a message from the mbox. */
goto again;
} else {
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
occured. The time variable is set to the number of
milliseconds we waited for the message. */
if (time <= timeouts->next->time) {
timeouts->next->time -= time;
} else {
timeouts->next->time = 0;
}
}

}
}

in the above function my code is hanging after these statements

again:
timeouts = sys_arch_timeouts();

if (!timeouts || !timeouts->next) {
sys_arch_mbox_fetch(mbox, msg, 0);

from sys_arch_mbox_fetch(mbox, msg, 0); it is not coming out side. Internally this function is called from netconn_new(NETCONN_TCP);

My sys_arch_mbox_fetch is like this

u16_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **data, u16_t timeout)
{
u8_t ucErr;
u16_t ucos_timeout;
//yangye 2003-1-27
//in lwip ,timeout is millisecond
//in ucosII ,timeout is timer tick!
//chang timeout from millisecond to ucos tick
ucos_timeout = 0;
if(timeout != 0){
ucos_timeout = timeout * (OS_TICKS_PER_SEC/1000);
if(ucos_timeout < 1)
ucos_timeout = 1;
else if(ucos_timeout > 65535)
ucos_timeout = 65535;
}

//yangye 2003-1-29
//it is very importent!!!!
//sometimes lwip calls sys_mbox_fetch(mbox,NULL)
//it is dangrous to return (void *) to NULL ! (from OSQPend())
if(data != NULL){
*data = OSQPend( mbox->pQ, (u16_t)ucos_timeout, &ucErr );
}else{
//just discard return value if data==NULL
OSQPend(mbox->pQ,(u16_t)ucos_timeout,&ucErr);
}

if( ucErr == OS_TIMEOUT ) {
timeout = 0;
} else {
if(data == (void)&pvNullPointer )
*data = NULL;
timeout = 1;
}
return timeout;
}

Please any body suggest me why it is hanging in sys_arch_mbox_fetch function, sorry for my bad English.

Tanks in advance
regards,
raghavendar


form_the_new_features_dept (posted by Christiaan Simons, Sat 09 Dec 2006 09:12:55 AM UTC)

Likewise forgot to mention a feature in 1.2.0, the SNMPv1 agent.

Docs appear inline and in lwip/doc/snmp_agent.txt


    

 

Back to the top


Powered by Savane 3.1-cleanup1