diff --git a/core/net/mac/lpp.c b/core/net/mac/lpp.c index 47b3cc201..52b71b55e 100644 --- a/core/net/mac/lpp.c +++ b/core/net/mac/lpp.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: lpp.c,v 1.28 2009/12/06 13:18:32 adamdunkels Exp $ + * $Id: lpp.c,v 1.29 2010/01/25 11:43:32 adamdunkels Exp $ */ /** @@ -882,6 +882,12 @@ off(int keep_radio_on) return 1; } /*---------------------------------------------------------------------------*/ +static unsigned short +channel_check_interval(void) +{ + return OFF_TIME + LISTEN_TIME; +} +/*---------------------------------------------------------------------------*/ const struct mac_driver lpp_driver = { "LPP", lpp_init, @@ -890,6 +896,7 @@ const struct mac_driver lpp_driver = { set_receive_function, on, off, + channel_check_interval, }; /*---------------------------------------------------------------------------*/ static void diff --git a/core/net/mac/mac.h b/core/net/mac/mac.h index 06c5850eb..684290661 100644 --- a/core/net/mac/mac.h +++ b/core/net/mac/mac.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: mac.h,v 1.7 2009/12/05 21:49:51 adamdunkels Exp $ + * $Id: mac.h,v 1.8 2010/01/25 11:43:32 adamdunkels Exp $ */ /** @@ -66,6 +66,9 @@ struct mac_driver { /** Turn the MAC layer off. */ int (* off)(int keep_radio_on); + + /** Returns the channel check interval, expressed in clock_time_t ticks. */ + unsigned short (* channel_check_interval)(void); }; /* Generic MAC return values. */ diff --git a/core/net/mac/nullmac.c b/core/net/mac/nullmac.c index 41daa45ed..02153f660 100644 --- a/core/net/mac/nullmac.c +++ b/core/net/mac/nullmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: nullmac.c,v 1.12 2009/12/05 13:29:41 adamdunkels Exp $ + * $Id: nullmac.c,v 1.13 2010/01/25 11:43:32 adamdunkels Exp $ */ /** @@ -93,6 +93,12 @@ off(int keep_radio_on) } } /*---------------------------------------------------------------------------*/ +static unsigned short +channel_check_interval(void) +{ + return 0; +} +/*---------------------------------------------------------------------------*/ const struct mac_driver nullmac_driver = { "nullmac", nullmac_init, @@ -101,6 +107,7 @@ const struct mac_driver nullmac_driver = { set_receive_function, on, off, + channel_check_interval, }; /*---------------------------------------------------------------------------*/ const struct mac_driver * diff --git a/core/net/mac/xmac.c b/core/net/mac/xmac.c index b202d76c6..40c44be1e 100644 --- a/core/net/mac/xmac.c +++ b/core/net/mac/xmac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: xmac.c,v 1.48 2010/01/14 20:14:03 adamdunkels Exp $ + * $Id: xmac.c,v 1.49 2010/01/25 11:43:32 adamdunkels Exp $ */ /** @@ -920,6 +920,12 @@ turn_off(int keep_radio_on) } } /*---------------------------------------------------------------------------*/ +static unsigned short +channel_check_interval(void) +{ + return (1ul * CLOCK_SECOND * DEFAULT_PERIOD) / RTIMER_ARCH_SECOND; +} +/*---------------------------------------------------------------------------*/ const struct mac_driver xmac_driver = { "X-MAC", @@ -928,5 +934,6 @@ const struct mac_driver xmac_driver = read_packet, set_receive_function, turn_on, - turn_off + turn_off, + channel_check_interval, };