Update for NETSTACK_CONF_FRAMER

This commit is contained in:
dak664 2010-03-02 16:25:47 +00:00
parent c65e09ceb2
commit d3697344ec
4 changed files with 78 additions and 123 deletions

View file

@ -83,9 +83,10 @@
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC sicslowmac_driver
#define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO rf230_driver
#define RF230_CONF_AUTO_ACK 1
#define RF230_CONF_AUTO_RETRIES 2
#define RF230_CONF_AUTOACK 1
#define RF230_CONF_AUTORETRIES 2
#define SICSLOWPAN_CONF_FRAG 1
//Most browsers reissue GETs after 3 seconds which stops frag reassembly, longer MAXAGE does no good
#define SICSLOWPAN_CONF_MAXAGE 3
@ -97,18 +98,20 @@
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC contikimac_driver
#define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO rf230_driver
#define RF230_CONF_AUTO_ACK 0
#define RF230_CONF_AUTO_RETRIES 0
#define RF230_CONF_AUTOACK 0
#define RF230_CONF_AUTORETRIES 0
#else
#elif 0
/* cx-mac radio cycling */
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC cxmac_driver
#define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO rf230_driver
#define RF230_CONF_AUTO_ACK 0
#define RF230_CONF_AUTO_RETRIES 0
#define RF230_CONF_AUTOACK 0
#define RF230_CONF_AUTORETRIES 0
#define MAC_CONF_CHANNEL_CHECK_RATE 8
#define SICSLOWPAN_CONF_FRAG 1
#define SICSLOWPAN_CONF_MAXAGE 3
@ -119,9 +122,11 @@
//Below gives 10% duty cycle, undef for default 5%
//#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 80)
//Below gives 50% duty cycle
#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
//#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
#endif /* Network setup */
#else
#error Network configuration not specified!
#endif /* Network setup */
/* Logging adds 200 bytes to program size */
#define LOG_CONF_ENABLED 1

View file

@ -32,13 +32,11 @@
*/
#define ANNOUNCE_BOOT 1 //adds about 600 bytes to program size
#define DEBUG 1
#define DEBUG 0
#if DEBUG
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
#define PRINTSHORT(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
#if RF230BB
extern char rf230_interrupt_flag, rf230processflag;
#endif
#else
#define PRINTF(...)
#define PRINTSHORT(...)
@ -50,7 +48,6 @@ extern char rf230_interrupt_flag, rf230processflag;
#include <stdio.h>
#include <string.h>
//#include "lib/mmem.h"
#include "loader/symbols-def.h"
#include "loader/symtab.h"
@ -58,15 +55,7 @@ extern char rf230_interrupt_flag, rf230processflag;
#include "radio/rf230bb/rf230bb.h"
#include "net/mac/frame802154.h"
#include "net/mac/framer-802154.h"
//#include "net/mac/framer-nullmac.h"
//#include "net/mac/framer.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"
//#include "dev/xmem.h"
//#include "net/rime.h"
#else //radio driver using Atmel/Cisco 802.15.4'ish MAC
#include <stdbool.h>
@ -104,7 +93,6 @@ extern char rf230_interrupt_flag, rf230processflag;
#endif
#include "net/rime.h"
//#include "node-id.h"
/*-------------------------------------------------------------------------*/
/*----------------------Configuration of the .elf file---------------------*/
@ -162,7 +150,6 @@ void initialize(void)
ctimer_init();
/* Start radio and radio receive process */
NETSTACK_RADIO.init();
//rf230_init();
/* Set addresses BEFORE starting tcpip process */
@ -174,17 +161,13 @@ void initialize(void)
memcpy(&uip_lladdr.addr, &addr.u8, 8);
rf230_set_pan_addr(IEEE802154_PANID, 0, (uint8_t *)&addr.u8);
rf230_set_channel(24);
rimeaddr_set_node_addr(&addr);
// set_rime_addr();
PRINTF("MAC address %x:%x:%x:%x:%x:%x:%x:%x\n",addr.u8[0],addr.u8[1],addr.u8[2],addr.u8[3],addr.u8[4],addr.u8[5],addr.u8[6],addr.u8[7]);
framer_set(&framer_802154);
// process_start(&tcpip_process, NULL); //must be done before network inits?
/* Setup X-MAC for 802.15.4 */
/* Initialize stack protocols */
queuebuf_init();
NETSTACK_RDC.init();
NETSTACK_MAC.init();
@ -196,7 +179,7 @@ void initialize(void)
unsigned short tmp;
tmp=CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval == 0 ? 1:\
NETSTACK_RDC.channel_check_interval());
printf_P(PSTR(", check rate %u Hz"),tmp);
if (tmp<65535) printf_P(PSTR(", check rate %u Hz"),tmp);
}
printf_P(PSTR("\n"));
#endif
@ -209,16 +192,14 @@ void initialize(void)
uip_router_register(&rimeroute);
#endif
#endif /*RF230BB*/
#if RF230BB
process_start(&tcpip_process, NULL);
#else
#else
/* mac process must be started before tcpip process! */
process_start(&mac_process, NULL);
process_start(&tcpip_process, NULL);
#endif /*RF230BB*/
#endif
#ifdef RAVEN_LCD_INTERFACE
process_start(&raven_lcd_process, NULL);
#endif
@ -320,7 +301,9 @@ struct rtimer rt;
void rtimercycle(void) {rtimerflag=1;}
#endif /* TESTRTIMER */
extern uint8_t packetreceived;
#if RF230BB
extern char rf230_interrupt_flag, rf230processflag;
#endif
/*-------------------------------------------------------------------------*/
/*------------------------- Main Scheduler loop----------------------------*/
/*-------------------------------------------------------------------------*/
@ -358,15 +341,13 @@ main(void)
}
#endif
//Use with RF230BB RADIOALWAYSON to show packets missed when radio is "off"
//Use with RF230BB DEBUGFLOW to show path through driver
#if RF230BB&&1
if (packetreceived) {
if (packetreceived==1) { //missed
printf("-");
} else { //passed to stack
printf("+");
}
packetreceived=0;
extern uint8_t debugflowsize,debugflow[];
if (debugflowsize) {
debugflow[debugflowsize]=0;
printf("%s",debugflow);
debugflowsize=0;
}
#endif

View file

@ -109,46 +109,50 @@ typedef int32_t s32_t;
#ifdef RF230BB
#define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 //for barebones driver, sicslowpan calls radio->read function
//#undef PACKETBUF_CONF_HDR_SIZE //RF230BB takes the packetbuf default for header size
#if 1 /* Network setup */
/* No radio cycling */
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC sicslowmac_driver
#define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO rf230_driver
#define RF230_CONF_AUTO_ACK 1
#define RF230_CONF_AUTO_RETRIES 2
#define RF230_CONF_AUTOACK 1
#define RF230_CONF_AUTORETRIES 2
#define QUEUEBUF_CONF_NUM 1
#define QUEUEBUF_CONF_REF_NUM 1
#define SICSLOWPAN_CONF_FRAG 1
#define SICSLOWPAN_CONF_MAXAGE 3
#define SICSLOWPAN_CONF_MAXAGE 5
#elif 0
/* Contiki-mac radio cycling */
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC contikimac_driver
#define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO rf230_driver
#define RF230_CONF_AUTO_ACK 0
#define RF230_CONF_AUTO_RETRIES 0
#define RF230_CONF_AUTOACK 0
#define RF230_CONF_AUTORETRIES 0
#else
#elif 0
/* cx-mac radio cycling */
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC cxmac_driver
#define NETSTACK_CONF_FRAMER framer_802154
#define NETSTACK_CONF_RADIO rf230_driver
#define RF230_CONF_AUTO_ACK 0
#define RF230_CONF_AUTO_RETRIES 0
#define RF230_CONF_AUTOACK 0
#define RF230_CONF_AUTORETRIES 0
#define MAC_CONF_CHANNEL_CHECK_RATE 8
#define SICSLOWPAN_CONF_FRAG 1
#define QUEUEBUF_CONF_NUM 4
#define QUEUEBUF_CONF_REF_NUM 2
#define SICSLOWPAN_CONF_MAXAGE 3
#define SICSLOWPAN_CONF_MAXAGE 5
//following gives 50% duty cycle, undef for default 5%
#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
#else
#error Network configuration not specified!
#endif /* Network setup */
#endif /* RF230BB */

View file

@ -33,10 +33,11 @@
/**
* \file
* Sample Contiki kernel for STK 501 development board
* Contiki 2.4 kernel for Jackdaw USB stick
*
* \author
* Simon Barner <barner@in.tum.de
* Simon Barner <barner@in.tum.de>
* David Kopf <dak664@embarqmail.com>
*/
#include <avr/pgmspace.h>
@ -46,20 +47,12 @@
#include <stdio.h>
#include <string.h>
/* Set ANNOUNCE to send boot messages to USB serial port */
#define ANNOUNCE 1
#if RF230BB //radio driver using contiki core mac
#if RF230BB //radio driver using contiki core mac
#include "radio/rf230bb/rf230bb.h"
#include "net/mac/frame802154.h"
#include "net/mac/framer-802154.h"
//#include "net/mac/framer-nullmac.h"
//#include "net/mac/framer.h"
#include "net/sicslowpan.h"
#include "net/uip-netif.h"
#include "net/mac/lpp.h"
//#include "dev/xmem.h"
#include "net/mac/sicslowmac.h"
#include "net/mac/cxmac.h"
#else //radio driver using Atmel/Cisco 802.15.4'ish MAC
@ -88,21 +81,22 @@
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
extern int rf230_interrupt_flag;
extern uint8_t rf230processflag;
rimeaddr_t addr,macLongAddr;
#endif /* RF230BB */
#if 1 //dummy tcpip process not needed?
PROCESS(tcpip_process, "tcpip dummy");
PROCESS_THREAD(tcpip_process, ev, data)
{
PROCESS_BEGIN();
PROCESS_END();
}
void
tcpip_ipv6_output(void)
{
printf("tcpipipv6output");
}
#endif
/* Set ANNOUNCE to send boot messages to USB serial port */
#define ANNOUNCE 1
/* Test rtimers, also useful for pings and time stamps in simulator */
#define TESTRTIMER 0
#if TESTRTIMER
#define PINGS 0
#define STAMPS 30
uint8_t rtimerflag=1;
uint16_t rtime;
struct rtimer rt;
void rtimercycle(void) {rtimerflag=1;}
#endif /* TESTRTIMER */
/*-------------------------------------------------------------------------*/
/*----------------------Configuration of the .elf file---------------------*/
@ -122,26 +116,8 @@ uint8_t mac_address[8] EEMEM = {0x02, 0x12, 0x13, 0xff, 0xfe, 0x14, 0x15, 0x16};
//uint8_t EEMEM server_name[16];
//uint8_t EEMEM domain_name[30];
#if RF230BB
rimeaddr_t macLongAddr;
#endif
/* Test rtimers, also useful for pings and time stamps in simulator */
#define TESTRTIMER 0
#if TESTRTIMER
#define PINGS 0
#define STAMPS 30
uint8_t rtimerflag=1;
uint16_t rtime;
struct rtimer rt;
void rtimercycle(void) {rtimerflag=1;}
#endif /* TESTRTIMER */
/*-------------------------Low level initialization-----------------*/
#if RF230BB
rimeaddr_t addr;
#endif
extern uint8_t packetreceived;
/*-------------------------------------------------------------------------*/
/*-----------------------------Low level initialization--------------------*/
static void initialize(void) {
/* Initialize hardware */
@ -165,7 +141,6 @@ static void initialize(void) {
/* Start radio and radio receive process */
/* Note this starts RF230 process, so must be done after process_init */
NETSTACK_RADIO.init();
//rf230_init();
/* Set addresses BEFORE starting tcpip process */
@ -185,15 +160,12 @@ static void initialize(void) {
memcpy(&uip_lladdr.addr, &addr.u8, 8);
rf230_set_pan_addr(IEEE802154_PANID, 0, (uint8_t *)&addr.u8);
rf230_set_channel(24);
rimeaddr_set_node_addr(&addr);
// set_rime_addr();
framer_set(&framer_802154);
// process_start(&tcpip_process, NULL);
/* Setup X-MAC for 802.15.4 */
/* Initialize stack protocols */
queuebuf_init();
NETSTACK_RDC.init();
NETSTACK_MAC.init();
@ -204,17 +176,13 @@ static void initialize(void) {
uip_router_register(&rimeroute);
#endif
}
#endif /*RF230BB*/
#if RF230BB
process_start(&tcpip_process, NULL);
#else
/* The order of starting these is important! */
process_start(&mac_process, NULL);
process_start(&tcpip_process, NULL);
#endif /* RF230BB */
#endif /* RF230BB */
/* Setup USB */
process_start(&usb_process, NULL);
@ -262,20 +230,17 @@ main(void)
}
#endif /* TESTRTIMER */
//Use with RF230BB RADIOALWAYSON to show packets missed when radio is "off"
//Use with RF230BB DEBUGFLOW to show path through driver
//Warning, Jackdaw doesn't handle simultaneous radio and USB interrupts very well.
#if 0
if (packetreceived) {
if (packetreceived==1) {
printf("-");
} else {
printf("+");
}
packetreceived=0;
}
#if RF230BB&&0
extern uint8_t debugflowsize,debugflow[];
if (debugflowsize) {
debugflow[debugflowsize]=0;
printf("%s",debugflow);
debugflowsize=0;
}
#endif
/* Allow USB CDC to keep up with printfs */
#if ANNOUNCE
if (firsttime) {
@ -292,7 +257,7 @@ main(void)
unsigned short tmp;
tmp=CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval == 0 ? 1:\
NETSTACK_RDC.channel_check_interval());
printf_P(PSTR(", check rate %u Hz"),tmp);
if (tmp<65535) printf_P(PSTR(", check rate %u Hz"),tmp);
}
printf_P(PSTR("\n\r"));
#endif /* RF230BB */
@ -302,7 +267,7 @@ main(void)
}
#endif /* ANNOUNCE */
#if DEBUG && 0
#if RF230BB&&0
if (rf230processflag) {
printf("**RF230 process flag %u\n\r",rf230processflag);
rf230processflag=0;
@ -313,7 +278,7 @@ main(void)
// }
rf230_interrupt_flag=0;
}
#endif /* DEBUG */
#endif
}
return 0;