Expose the Rime MAC driver so that applications can use it - a bit of a hack, but it works for now

This commit is contained in:
adamdunkels 2007-12-05 13:21:58 +00:00
parent d8617c7879
commit 442516356a
2 changed files with 10 additions and 8 deletions

View File

@ -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__ */
/** @} */

View File

@ -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();
}
}
/*---------------------------------------------------------------------------*/