Added a configuration option for setting the MAC channel check rate (which must be a power of two). The configuration is independent of the MAC protocol.
This commit is contained in:
parent
f06c7a8ffd
commit
181213124b
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: cxmac.c,v 1.6 2010/02/02 16:33:07 adamdunkels Exp $
|
||||
* $Id: cxmac.c,v 1.7 2010/02/02 23:28:58 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -114,7 +114,7 @@ struct cxmac_hdr {
|
||||
#ifdef CXMAC_CONF_OFF_TIME
|
||||
#define DEFAULT_OFF_TIME (CXMAC_CONF_OFF_TIME)
|
||||
#else
|
||||
#define DEFAULT_OFF_TIME (RTIMER_ARCH_SECOND / 4 - DEFAULT_ON_TIME)
|
||||
#define DEFAULT_OFF_TIME (RTIMER_ARCH_SECOND / MAC_CHANNEL_CHECK_RATE - DEFAULT_ON_TIME)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_PERIOD (DEFAULT_OFF_TIME + DEFAULT_ON_TIME)
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: lpp.c,v 1.29 2010/01/25 11:43:32 adamdunkels Exp $
|
||||
* $Id: lpp.c,v 1.30 2010/02/02 23:28:58 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -90,7 +90,7 @@
|
||||
#ifdef LPP_CONF_OFF_TIME
|
||||
#define OFF_TIME LPP_CONF_OFF_TIME
|
||||
#else
|
||||
#define OFF_TIME (CLOCK_SECOND / 2 - LISTEN_TIME)
|
||||
#define OFF_TIME (CLOCK_SECOND / MAC_CHANNEL_CHECK_RATE - LISTEN_TIME)
|
||||
#endif /* LPP_CONF_OFF_TIME */
|
||||
|
||||
#define PACKET_LIFETIME (LISTEN_TIME + OFF_TIME)
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: mac.h,v 1.8 2010/01/25 11:43:32 adamdunkels Exp $
|
||||
* $Id: mac.h,v 1.9 2010/02/02 23:28:58 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -90,4 +90,15 @@ enum {
|
||||
MAC_TX_ERR_FATAL,
|
||||
};
|
||||
|
||||
#ifdef MAC_CONF_CHANNEL_CHECK_RATE
|
||||
#define MAC_CHANNEL_CHECK_RATE MAC_CONF_CHANNEL_CHECK_RATE
|
||||
#else /* MAC_CHANNEL_CHECK_RATE */
|
||||
#define MAC_CHANNEL_CHECK_RATE 4
|
||||
#endif /* MAC_CHANNEL_CHECK_RATE */
|
||||
|
||||
#if (MAC_CHANNEL_CHECK_RATE & (MAC_CHANNEL_CHECK_RATE - 1)) != 0
|
||||
#error MAC_CONF_CHANNEL_CHECK_RATE must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...).
|
||||
#error Change MAC_CONF_CHANNEL_CHECK_RATE in contiki-conf.h or in your Makefile.
|
||||
#endif
|
||||
|
||||
#endif /* __MAC_H__ */
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: xmac.c,v 1.50 2010/01/28 13:40:47 adamdunkels Exp $
|
||||
* $Id: xmac.c,v 1.51 2010/02/02 23:28:58 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -114,7 +114,7 @@ struct xmac_hdr {
|
||||
#ifdef XMAC_CONF_OFF_TIME
|
||||
#define DEFAULT_OFF_TIME (XMAC_CONF_OFF_TIME)
|
||||
#else
|
||||
#define DEFAULT_OFF_TIME (RTIMER_ARCH_SECOND / 4 - DEFAULT_ON_TIME)
|
||||
#define DEFAULT_OFF_TIME (RTIMER_ARCH_SECOND / MAC_CHANNEL_CHECK_RATE - DEFAULT_ON_TIME)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_PERIOD (DEFAULT_OFF_TIME + DEFAULT_ON_TIME)
|
||||
|
Loading…
Reference in New Issue
Block a user