From 32a3fa5d4ae79fcdbeb7996bef0d7b348fac6bbe Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Sun, 24 Feb 2008 21:05:28 +0000 Subject: [PATCH] Added parameter to the mac off() method that specifies whether or not the radio should be turned off when the MAC layer is turned off --- core/net/mac/mac.h | 4 ++-- core/net/mac/nullmac.c | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/net/mac/mac.h b/core/net/mac/mac.h index d5ebcf6d6..acaf43110 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.1 2007/05/25 06:40:19 adamdunkels Exp $ + * $Id: mac.h,v 1.2 2008/02/24 21:05:28 adamdunkels Exp $ */ /** @@ -58,7 +58,7 @@ struct mac_driver { int (* on)(void); /** Turn the MAC layer off. */ - int (* off)(void); + int (* off)(int keep_radio_on); }; diff --git a/core/net/mac/nullmac.c b/core/net/mac/nullmac.c index f2ea792e3..5a8dcc8de 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.6 2007/12/23 14:56:54 oliverschmidt Exp $ + * $Id: nullmac.c,v 1.7 2008/02/24 21:05:28 adamdunkels Exp $ */ /** @@ -81,9 +81,13 @@ on(void) } /*---------------------------------------------------------------------------*/ static int -off(void) +off(int keep_radio_on) { - return radio->off(); + if(keep_radio_on) { + return radio->on(); + } else { + return radio->off(); + } } /*---------------------------------------------------------------------------*/ const struct mac_driver nullmac_driver = {