|
From: | Angel CODREAN |
Subject: | Re: [lwip-users] Getting started with lwIP on a NON-SYS platform |
Date: | Wed, 27 Jun 2012 17:42:32 +0200 |
Thank you for the info. I tried to implement it and when I am running it, I cannot allocate a pbuf chain of pbufs from the pool. I attached the code of the low_level_input() implementation. len had different values from 1500 to 100 to 10.static struct pbuf *low_level_input(struct netif *netif)
{
struct pbuf *p;
u16_t len=10;
/* We allocate a pbuf chain of pbufs from the pool. */
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
if (p != NULL)
{
KSZ8851SNL_receive(p->payload, &(p->len));
LINK_STATS_INC(link.recv);
} else
{
//TODO drop packet();
LINK_STATS_INC(link.memerr);
LINK_STATS_INC(link.drop);
}
return p;
}On Wed, Jun 27, 2012 at 3:29 PM, Simon Goldschmidt <address@hidden> wrote:
Angel CODREAN <address@hidden> wrote:That is totally not the way it should be. Please have a look at the ethernetif.c skeleton file to see how a driver should interact with lwIP.
> LWIP_driver_input is the method I implemented in my driver in order to
> receive packages from the ethernet driver
>
> /** Called when a packet is received */
> err_t LWIP_driver_input(struct pbuf *pbuf, struct netif *netif)
> {
> struct pbuf *p=(struct pbuf*)malloc(sizeof(struct pbuf));
> driver_receive(p->payload, &(p->tot_len));
> ethernet_input(p, netif);
> return ERR_OK;
> }
LwIP will *never* call your LWIP_driver_input() function, it is up to you to schedule a call to this function (either by polling the driver or by getting an RX interrupt).
Simon
--
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
[Prev in Thread] | Current Thread | [Next in Thread] |