From 91f8c4b8e45861d0542885162562216fbae507de Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 14 Mar 2007 00:29:05 +0000 Subject: [PATCH] Renamed driver output function to abc_driver_send --- core/net/rime/abc-udp.c | 7 +++---- core/net/rime/abc.c | 12 +++++++----- core/net/rime/abc.h | 19 ++++++++++++++++++- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/core/net/rime/abc-udp.c b/core/net/rime/abc-udp.c index 89a64abdd..9f3b2a8ca 100644 --- a/core/net/rime/abc-udp.c +++ b/core/net/rime/abc-udp.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: abc-udp.c,v 1.2 2007/03/13 13:02:33 adamdunkels Exp $ + * $Id: abc-udp.c,v 1.3 2007/03/14 00:29:05 adamdunkels Exp $ */ /** @@ -63,9 +63,8 @@ PROCESS_THREAD(abc_udp_process, ev, data) } /*---------------------------------------------------------------------------*/ void -abc_arch_send(u8_t *buf, int len) +abc_driver_send(void) { - uip_udp_packet_send(c, uip_buf, uip_len); - return 1; + uip_udp_packet_send(c, rimebuf_hdrptr(), rimebuf_totlen()); } /*---------------------------------------------------------------------------*/ diff --git a/core/net/rime/abc.c b/core/net/rime/abc.c index d8ab7a477..6daa5768b 100644 --- a/core/net/rime/abc.c +++ b/core/net/rime/abc.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: abc.c,v 1.1 2007/03/13 13:01:48 adamdunkels Exp $ + * $Id: abc.c,v 1.2 2007/03/14 00:29:05 adamdunkels Exp $ */ /** @@ -59,8 +59,6 @@ void abc_setup(struct abc_conn *c, u16_t channel, const struct abc_ulayer *ulayer) { - struct channel *chan; - c->channel = channel; c->u = ulayer; @@ -73,9 +71,11 @@ abc_send(struct abc_conn *c) if(rimebuf_hdrextend(sizeof(struct abc_hdr))) { struct abc_hdr *hdr = rimebuf_hdrptr(); + DEBUGF(1, "%d: abc: abc_send on channel %d\n", node_id, c->channel); + hdr->channel = c->channel; - rimebuf_copy_reference(); - abc_arch_send(rimebuf_hdrptr(), rimebuf_totlen()); + rimebuf_compact(); + abc_driver_send(); return 1; } return 0; @@ -88,6 +88,8 @@ abc_input_packet(void) struct abc_conn *c; hdr = rimebuf_dataptr(); + + DEBUGF(1, "%d: abc: abc_input_packet on channel %d\n", node_id, hdr->channel); if(rimebuf_hdrreduce(sizeof(struct abc_hdr))) { diff --git a/core/net/rime/abc.h b/core/net/rime/abc.h index f7d4ec576..401993ad2 100644 --- a/core/net/rime/abc.h +++ b/core/net/rime/abc.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: abc.h,v 1.2 2007/03/13 13:01:48 adamdunkels Exp $ + * $Id: abc.h,v 1.3 2007/03/14 00:29:05 adamdunkels Exp $ */ /** @@ -105,5 +105,22 @@ int abc_send(struct abc_conn *c); */ void abc_input_packet(void); +/** + * \brief This function, which must be implemented by the driver, is called to send out a packet + * + * This function is implemented by the driver running + * below abc and is called by abc to send out a + * packet. The packet is contained in the rimebuf. The + * packet is consecutive in the rimebuf and a pointer to + * the first byte is gotten from the rimebuf_hdrptr() + * function. The length of the packet to send is gotten + * with the rimebuf_totlen() function. + * + * The driver, which typically is a MAC protocol, may + * queue the packet by using the queuebuf functions. + * + */ +void abc_driver_send(void); + #endif /* __BC_H__ */ /** @} */