From 442516356aeb51b28c95080dd2238f861b2d98ff Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 5 Dec 2007 13:21:58 +0000 Subject: [PATCH] Expose the Rime MAC driver so that applications can use it - a bit of a hack, but it works for now --- core/net/rime.h | 4 +++- core/net/rime/rime.c | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/net/rime.h b/core/net/rime.h index 43b58a567..ab9d57951 100644 --- a/core/net/rime.h +++ b/core/net/rime.h @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rime.h,v 1.10 2007/11/28 19:54:24 adamdunkels Exp $ + * $Id: rime.h,v 1.11 2007/12/05 13:21:58 adamdunkels Exp $ */ /** @@ -94,6 +94,8 @@ void rime_driver_send(void); void rime_set_output(void (*output_function)(void)); void rime_output(void); +extern const struct mac_driver *rime_mac; + #endif /* __RIME_H__ */ /** @} */ diff --git a/core/net/rime/rime.c b/core/net/rime/rime.c index 87acd7983..047feda77 100644 --- a/core/net/rime/rime.c +++ b/core/net/rime/rime.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rime.c,v 1.12 2007/11/15 13:07:42 nifi Exp $ + * $Id: rime.c,v 1.13 2007/12/05 13:21:58 adamdunkels Exp $ */ /** @@ -48,13 +48,13 @@ #include "net/rime/route.h" #include "net/mac/mac.h" -static const struct mac_driver *mac; +const struct mac_driver *rime_mac; /*---------------------------------------------------------------------------*/ static void input(const struct mac_driver *r) { int len; - len = mac->read(); + len = rime_mac->read(); if(len > 0) { RIMESTATS_ADD(rx); abc_input_packet(); @@ -68,8 +68,8 @@ rime_init(const struct mac_driver *m) route_init(); rimebuf_clear(); neighbor_init(); - mac = m; - mac->set_receive_function(input); + rime_mac = m; + rime_mac->set_receive_function(input); } /*---------------------------------------------------------------------------*/ void @@ -77,8 +77,8 @@ rime_output(void) { RIMESTATS_ADD(tx); rimebuf_compact(); - if(mac) { - mac->send(); + if(rime_mac) { + rime_mac->send(); } } /*---------------------------------------------------------------------------*/