From: Adam D. <ada...@us...> - 2008-06-30 08:10:07
|
Update of /cvsroot/contiki/contiki-2.x/core/net/mac In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14729 Modified Files: xmac.c Log Message: Added name to mac structure. Do not turn radio on when sending a broadcast packet. Changed default off time to half a second. Index: xmac.c =================================================================== RCS file: /cvsroot/contiki/contiki-2.x/core/net/mac/xmac.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** xmac.c 25 Feb 2008 02:14:35 -0000 1.18 --- xmac.c 30 Jun 2008 08:10:02 -0000 1.19 *************** *** 77,81 **** #define DEFAULT_OFF_TIME (XMAC_CONF_OFF_TIME) #else ! #define DEFAULT_OFF_TIME (RTIMER_ARCH_SECOND / 8 - DEFAULT_ON_TIME) #endif --- 77,81 ---- #define DEFAULT_OFF_TIME (XMAC_CONF_OFF_TIME) #else ! #define DEFAULT_OFF_TIME (RTIMER_ARCH_SECOND / 2 - DEFAULT_ON_TIME) #endif *************** *** 261,264 **** --- 261,265 ---- struct xmac_hdr msg; int len; + int is_broadcast = 0; #if WITH_TIMETABLE *************** *** 298,301 **** --- 299,305 ---- rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr); rimeaddr_copy(&hdr->receiver, rimebuf_addr(RIMEBUF_ADDR_RECEIVER)); + if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_null)) { + is_broadcast = 1; + } rimebuf_compact(); *************** *** 309,315 **** /* Send a train of strobes until the receiver answers with an ACK. */ ! /* Turn on the radio to listen for the strobe ACK. XXX for ! broadcasts, don't turn radio on at all. */ ! on(); watchdog_stop(); --- 313,320 ---- /* Send a train of strobes until the receiver answers with an ACK. */ ! /* Turn on the radio to listen for the strobe ACK. */ ! if(!is_broadcast) { ! on(); ! } watchdog_stop(); *************** *** 378,381 **** --- 383,387 ---- } + /* Send the data packet. */ if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_null) || got_ack) { #if WITH_TIMETABLE *************** *** 575,578 **** --- 581,585 ---- const struct mac_driver xmac_driver = { + "X-MAC", qsend_packet, read_packet, |