lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwIP and Ping


From: HM2
Subject: Re: [lwip-users] lwIP and Ping
Date: Wed, 19 Nov 2008 09:12:54 -0800

There is a sys_now() prototype defined in sys.h, but I can't find a body
anywhere.

I looked on the web and found a sys_unix_now:

unsigned long sys_unix_now() {
  struct timeval tv;
  struct timezone tz;
  long sec, usec;
  unsigned long msec;
  gettimeofday(&tv, &tz);

  sec = tv.tv_sec - starttime.tv_sec;
  usec = tv.tv_usec - starttime.tv_usec;
  msec = sec * 1000 + usec / 1000;

  return msec;
}

However when I rename this to sys_now() and put it in sys.c and compile, I
get the following:

lwIP/src/core/sys.c: In function `sys_now':
lwIP/src/core/sys.c:345: error: storage size of 'tv' isn't known
lwIP/src/core/sys.c:346: error: storage size of 'tz' isn't known
lwIP/src/core/sys.c:349: warning: implicit declaration of function
`gettimeofday'
lwIP/src/core/sys.c:351: error: `starttime' undeclared (first use in this
function)
lwIP/src/core/sys.c:351: error: (Each undeclared identifier is reported only
once
lwIP/src/core/sys.c:351: error: for each function it appears in.)
lwIP/src/core/sys.c:345: warning: unused variable `tv'
lwIP/src/core/sys.c:346: warning: unused variable `tz'
D:\GNUARM\bin\make.exe: *** [lwIP/src/core/sys.o] Error 1

I can probably make some guesses and try to get these resolved, but it would
be nice to know how this is all suppose to work.  It looks like this is some
kind of RealTimeClock kind of function.  There is an incude for sys/time.h

My implementation is an MCU LPC2468 ARM7.  I do have a real time clock that
I am using in it.  Is the return suppose to be some real time value, or does
it just want a tick count ?

Thanks,  Chris.



----- Original Message ----- 
From: "Kieran Mansley" <address@hidden>
To: "Mailing list for lwIP users" <address@hidden>
Sent: Wednesday, November 19, 2008 5:28 AM
Subject: Re: [lwip-users] lwIP and Ping


> On Wed, 2008-11-19 at 04:12 -0800, HM2 wrote:
> > The contrib 1.30 has a ping.c and ping.h   What is the manner to hook
> > these in?
> > I assume the ping_init should be called after tcp_init, but there is a
> > "sys_now()" call that comes up undefined in ping.c.
>
> sys_now() should be defined by your port.  For example the win32 port
> defines it in contrib/ports/win32/sys_arch.c.
>
> The unix port however doesn't seem to be defining it.  It has a function
> in contrib/ports/unix/sys_arch.c called sys_unix_now() which looks
> right, but seems to have the wrong name.  I'll check in a change to fix
> that.
>
> Kieran
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]