mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-05 14:04:38 +08:00
finally got zepif running
This commit is contained in:
parent
ab0e457066
commit
282e1601ef
@ -409,7 +409,7 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr
|
|||||||
MIB2_STATS_NETIF_INC(netif, ifoutdiscards);
|
MIB2_STATS_NETIF_INC(netif, ifoutdiscards);
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
LWIP_ASSERT("this needs a pbuf in one piece", p->len == p->tot_len);
|
LWIP_ASSERT("this needs a pbuf in one piece", p_frag->len == p_frag->tot_len);
|
||||||
|
|
||||||
/* Write IEEE 802.15.4 header. */
|
/* Write IEEE 802.15.4 header. */
|
||||||
buffer = (u8_t *)p_frag->payload;
|
buffer = (u8_t *)p_frag->payload;
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
#include "netif/lowpan6.h"
|
#include "netif/lowpan6.h"
|
||||||
#include "lwip/udp.h"
|
#include "lwip/udp.h"
|
||||||
|
#include "lwip/timeouts.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/** Define this to 1 to loop back TX packets for testing */
|
/** Define this to 1 to loop back TX packets for testing */
|
||||||
@ -92,6 +93,18 @@ struct zepif_state {
|
|||||||
u32_t seqno;
|
u32_t seqno;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static u8_t zep_lowpan_timer_running;
|
||||||
|
|
||||||
|
/* Helper function that calls the 6LoWPAN timer and reschedules itself */
|
||||||
|
static void
|
||||||
|
zep_lowpan_timer(void *arg)
|
||||||
|
{
|
||||||
|
lowpan6_tmr();
|
||||||
|
if (zep_lowpan_timer_running) {
|
||||||
|
sys_timeout(LOWPAN6_TMR_INTERVAL, zep_lowpan_timer, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Pass received pbufs into 6LowPAN netif */
|
/* Pass received pbufs into 6LowPAN netif */
|
||||||
static void
|
static void
|
||||||
zepif_udp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
zepif_udp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||||
@ -138,6 +151,9 @@ zepif_udp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
|||||||
if (pbuf_remove_header(p, sizeof(struct zep_hdr))) {
|
if (pbuf_remove_header(p, sizeof(struct zep_hdr))) {
|
||||||
goto err_return;
|
goto err_return;
|
||||||
}
|
}
|
||||||
|
/* TODO Check CRC? */
|
||||||
|
/* remove CRC trailer */
|
||||||
|
pbuf_realloc(p, p->tot_len - 2);
|
||||||
|
|
||||||
/* Call tcpip_6lowpan_input here, not netif->input as we know the direct call
|
/* Call tcpip_6lowpan_input here, not netif->input as we know the direct call
|
||||||
* stack won't work as we could enter udp_input twice. */
|
* stack won't work as we could enter udp_input twice. */
|
||||||
@ -259,6 +275,12 @@ zepif_init(struct netif *netif)
|
|||||||
netif->hwaddr[0] &= 0xfc;
|
netif->hwaddr[0] &= 0xfc;
|
||||||
}
|
}
|
||||||
netif->linkoutput = zepif_linkoutput;
|
netif->linkoutput = zepif_linkoutput;
|
||||||
|
|
||||||
|
if (!zep_lowpan_timer_running) {
|
||||||
|
sys_timeout(LOWPAN6_TMR_INTERVAL, zep_lowpan_timer, NULL);
|
||||||
|
zep_lowpan_timer_running = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user