lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: [lwip] Problem with timeouts


From: Scott Robinson
Subject: [lwip-users] Re: [lwip] Problem with timeouts
Date: Thu, 09 Jan 2003 00:46:26 -0000

--cWoXeonUoKmBZSoM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Might it be that if MEM_SIZE is under 64000, mem_size_t is defined at
uint16?

Scott.

* Martin Glunz translated into ASCII [Thu, Nov 21, 2002 at 06:46:32AM +0100=
][<address@hidden>]
> David Haas wrote:
> >=20
> ...=20
> > Now can solve this by creating a special thread just to do the
> > initialization which will then always wait for a semaphore it will
> > never get, but I think this points out some deeper weakness with
> > lwip's interaction with an rtos.=20
>=20
> At the moment, I've done this exactly this way. But my simple
> cooperative OS has a timer facility, I'd like to use this for
> the timeouts.
>=20
> >=20
> > On a similar note, I think there should be an option for users to have
> > their own malloc as part of a port and use of mem_malloc should be
> > optional. (where perhaps an conditional compile calls a sys_malloc
> > function instead of mem_malloc).
> This is easily done by replacing the mem.c module with your own. Just
> include such a module in your source, and link it before the lwip
> library gets linked. Declare MEM_SIZE in lwipopts.h to zero.=20
> I've attached my mem.c source for example.
> Note that I increase the size of the allocated memory a bit, otherwise
> I get CPU address errors from the SH. There seems to be a problem with
> the memory sizes, but I haven't found this yet.
>=20
>=20
> --=20
>=20
> Martin Glunz
>=20
>=20
> fortune says today:
> Q:  Why do ducks have flat feet?
> A:  To stamp out forest fires.
>=20
> Q:  Why do elephants have flat feet?
> A:  To stamp out flaming ducks.
>=20
> WANTED: Schr?dinger's Cat. Dead or Alive.
>=20
> There are only 10 kinds of people. Those who
> understand binary and those who don't.
>=20
> /*-----------------------------------------------------------------------=
------------*/
> /* mem.c
>  *
>  * Memory manager.
>  *
>  */
> /*-----------------------------------------------------------------------=
------------*/
> #include <stdlib.h>
>=20
> #include "lwip/debug.h"
>=20
> #include "lwip/arch.h"
> #include "lwip/opt.h"
> #include "lwip/def.h"
> #include "lwip/mem.h"
>=20
> #include "lwip/sys.h"
>=20
> #include "lwip/stats.h"
>=20
> void
> mem_init(void)
> { }
>=20
> /*-----------------------------------------------------------------------=
------------*/
> void *
> mem_malloc(mem_size_t size)
> {
>   void *xx;
>   int new_sz=3Dsize+32-(size & 0x0f);
>   xx=3Dmalloc(new_sz);
>   DEBUGF(MEM_DEBUG,("malloc %d %08X\n",new_sz,(int)xx));
>   return xx;
> }
> /*-----------------------------------------------------------------------=
------------*/
> void
> mem_free(void *rmem)
> {
>   DEBUGF(MEM_DEBUG,("free %08X\n",(int)rmem));
>   free(rmem);
> }
> /*-----------------------------------------------------------------------=
------------*/
> void *
> mem_reallocm(void *rmem, mem_size_t newsize)
> {
>   void *xx;
>   int new_sz=3Dnewsize+32-(newsize & 0x0f);
>   xx=3Drealloc(rmem, new_sz);
>   DEBUGF(MEM_DEBUG,("reallocm %d %08X\n",new_sz,(int)xx));
>   return xx;
> }
> /*-----------------------------------------------------------------------=
------------*/
> void *
> mem_realloc(void *rmem, mem_size_t newsize)
> {
>   void *xx;
>   int new_sz=3Dnewsize+32-(newsize & 0x0f);
>   xx=3Drealloc(rmem, new_sz);
>   DEBUGF(MEM_DEBUG,("realloc %d %08X\n",new_sz,(int)xx));
>   return xx;
> }
> /*-----------------------------------------------------------------------=
------------*/


--=20
http://quadhome.com/           - Personal webpage
tranzoa.net                    - Firewall

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GAT dpu s: a--- C++ UL+++ P++ L+++ E- W++ N++ o+ K++ w++=20
O M V(-) PS+ PE Y+ PGP+++ t@ 5 X- R- tv(-) b++++ DI++++ D+=20
G e* h! r* y=20
------END GEEK CODE BLOCK------

--cWoXeonUoKmBZSoM
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iEYEARECAAYFAj3cjH8ACgkQ+1+mlYgeODftIwCgyE1ND3Z/dhze+CR8akINfoid
X0IAn0SKjIJqD0XDg3dF+8V9+v88/98+
=7Y1o
-----END PGP SIGNATURE-----

--cWoXeonUoKmBZSoM--
[This message was sent through the lwip discussion list.]




reply via email to

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