Specify mac driver in contiki-conf.h

This commit is contained in:
dak664 2010-02-16 22:22:13 +00:00
parent 53801ffbb1
commit 1da06eff83
2 changed files with 55 additions and 9 deletions

View File

@ -51,6 +51,7 @@ typedef int32_t s32_t;
*/
#define MCU_MHZ 8
#define PLATFORM PLATFORM_AVR
/*TODO:Who defines RAVEN_REVISION = RAVEN_D needed by hal.h? */
/* Clock ticks per second */
#define CLOCK_CONF_SECOND 125
@ -94,13 +95,25 @@ typedef int32_t s32_t;
/* RF230BB reduces program size by 6.5KB, RAM by 500 bytes */
#ifdef RF230BB
#define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 //for barebones driver, sicslowpan calls radio->read function
#undef PACKETBUT_CONF_HDR_SIZE //RF230BB takes the packetbuf default for header size
#undef PACKETBUF_CONF_HDR_SIZE //RF230BB takes the packetbuf default for header size
#define UIP_CONF_ROUTER 0
#if 0
/* Specifies the default MAC driver */
#define MAC_CONF_CSMA 1
#define XMAC_CONF_COMPOWER 1
#define CXMAC_CONF_COMPOWER 1
#define MAC_CONF_DRIVER cxmac_driver
#define MAC_CONF_CHANNEL_CHECK_RATE 8
#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0
#define CXMAC_CONF_ANNOUNCEMENTS 0
#define XMAC_CONF_ANNOUNCEMENTS 0
#endif
//#undef SICSLOWPAN_CONF_FRAG
//#define SICSLOWPAN_CONF_FRAG 0 //for sky equivalence with barebones driver
//#define UIP_CONF_BUFFER_SIZE 256 //for sky equivalence with barebones driver
//#define UIP_CONF_ROUTER 1
#define UIP_CONF_ROUTER 0
#endif
#endif /*RF230BB */
#define SICSLOWPAN_CONF_MAXAGE 5

View File

@ -30,7 +30,7 @@
*
* @(#)$$
*/
#define DEBUG 0
#define DEBUG 1
#if DEBUG
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
int pingtimer1=0,pingtimer2=0;
@ -56,7 +56,23 @@ extern int rf230_interrupt_flag;
#include "net/mac/frame802154.h"
#include "net/sicslowpan.h"
#include "net/uip-netif.h"
//#include "net/mac/lpp.h"
#include "net/mac/cxmac.h"
#include "net/mac/sicslowmac.h"
#if WITH_NULLMAC
#define MAC_DRIVER nullmac_driver
#endif /* WITH_NULLMAC */
#ifndef MAC_DRIVER
#ifdef MAC_CONF_DRIVER
#define MAC_DRIVER MAC_CONF_DRIVER
#else
#define MAC_DRIVER sicslowmac_driver
//#define MAC_DRIVER cxmac_driver
#endif /* MAC_CONF_DRIVER */
#endif /* MAC_DRIVER */
#else //radio driver using Atmel/Cisco 802.15.4'ish MAC
#include <stdbool.h>
#include "mac.h"
@ -160,9 +176,24 @@ void initialize(void)
{
/* Start radio and radio receive process */
rf230_init();
sicslowpan_init(sicslowmac_init(&rf230_driver));
// ctimer_init();
// sicslowpan_init(sicslowmac_init(&rf230_driver));
sicslowpan_init(MAC_DRIVER.init(&rf230_driver));
// ctimer_init();
rtimer_init();
// queuebuf_init();
// sicslowpan_init(csma_init(MAC_DRIVER.init(&cc2420_driver)));
// sicslowpan_init(MAC_DRIVER.init(&rf230_driver));
// printf(" %s, channel check rate %d Hz, radio channel %u\n",
// sicslowpan_mac->name,
// CLOCK_SECOND / (sicslowpan_mac->channel_check_interval() == 0? 1:
// sicslowpan_mac->channel_check_interval()),
// RF_CHANNEL);
// sicslowpan_init(lpp_init(&rf230_driver));
// sicslowpan_init(cxmac_init(&rf230_driver));
// sicslowpan_init(xmac_init(&rf230_driver));
// rime_init(sicslowmac_driver.init(&rf230_driver));
// rime_init(lpp_init(&rf230_driver));
@ -187,11 +218,13 @@ void initialize(void)
// PRINTF("Prefix %x::/%u\n",ipprefix.u16[0],UIP_DEFAULT_PREFIX_LEN);
#if UIP_CONF_ROUTER
#warning Routing enabled
PRINTF("Routing Enabled\n")
rime_init(rime_udp_init(NULL));
uip_router_register(&rimeroute);
#endif
PRINTF("Driver: %s, Channel: %u\n", sicslowmac_driver.name, rf230_get_channel());
PRINTF("Driver: %s, Channel: %u\n\r", MAC_DRIVER.name, rf230_get_channel());
//PRINTF("Driver: %s, Channel: %u\n", sicslowmac_driver.name, rf230_get_channel());
}
#endif /*RF230BB*/
@ -295,7 +328,7 @@ main(void)
while(1) {
process_run();
#if DEBUG
#if 0
if (rf230_interrupt_flag) {
if (rf230_interrupt_flag!=11) {
PRINTF("*****Radio interrupt %u\n",rf230_interrupt_flag);