[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250/mac
SpeckMacDP.nc, 1.5, 1.6 RedMacP.nc, 1.16, 1.17 CsmaMacP.nc,
1.15, 1.16 CsmaMacC.nc, 1.7, 1.8
akoepke
andreaskoepke at users.sourceforge.net
Wed Mar 5 03:20:46 PST 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv4171/chips/tda5250/mac
Modified Files:
SpeckMacDP.nc RedMacP.nc CsmaMacP.nc CsmaMacC.nc
Log Message:
solve dependencies on baudrate automagically
Index: SpeckMacDP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/SpeckMacDP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SpeckMacDP.nc 13 Feb 2008 10:32:15 -0000 1.5
--- SpeckMacDP.nc 5 Mar 2008 11:20:43 -0000 1.6
***************
*** 133,147 ****
/**************** Module Global Constants *****************/
enum {
! /*
! BYTE_TIME=21, // byte at 23405 kBit/s, 4b6b encoded
! PREAMBLE_BYTE_TIME=14, // byte at 23405 kBit/s, no coding
! PHY_HEADER_TIME=84, // 6 Phy Preamble at 23405 bits/s
! TIME_CORRECTION=16, // difference between txSFD and rxSFD: 475us
! */
! BYTE_TIME=14, // byte at 35108 kBit/s, 4b6b encoded
! PREAMBLE_BYTE_TIME=9, // byte at 35108 kBit/s, no coding
! PHY_HEADER_TIME=56, // 6 Phy Preamble at 35108 bits/s
! TIME_CORRECTION=11, // difference between txSFD and rxSFD: to do
!
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(message_header_t)*BYTE_TIME,
SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
--- 133,142 ----
/**************** Module Global Constants *****************/
enum {
!
! BYTE_TIME=ENCODED_32KHZ_BYTE_TIME, // phy encoded
! PREAMBLE_BYTE_TIME=TDA5250_32KHZ_BYTE_TIME, // no coding
! PHY_HEADER_TIME=6*PREAMBLE_BYTE_TIME, // 6 Phy Preamble
! TIME_CORRECTION=TDA5250_32KHZ_BYTE_TIME+2, // difference between txSFD and rxSFD
!
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(message_header_t)*BYTE_TIME,
SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
***************
*** 509,517 ****
bool isNewMsg(message_t* msg) {
! return call Duplicate.isNew(getHeader(msg)->src, (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
void rememberMsg(message_t* msg) {
! call Duplicate.remember(getHeader(msg)->src, (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
--- 504,514 ----
bool isNewMsg(message_t* msg) {
! return call Duplicate.isNew(getHeader(msg)->src, getHeader(msg)->dest,
! (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
void rememberMsg(message_t* msg) {
! call Duplicate.remember(getHeader(msg)->src, getHeader(msg)->dest,
! (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
Index: RedMacP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/RedMacP.nc,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** RedMacP.nc 13 Feb 2008 10:32:15 -0000 1.16
--- RedMacP.nc 5 Mar 2008 11:20:43 -0000 1.17
***************
*** 139,160 ****
/**************** Module Global Constants *****************/
enum {
- /*
- BYTE_TIME=21, // byte at 23405 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=14, // byte at 23405 kBit/s, no coding
- PHY_HEADER_TIME=84, // 6 Phy Preamble at 23405 bits/s
- TIME_CORRECTION=16, // difference between txSFD and rxSFD: 475us
- */
- BYTE_TIME=14, // byte at 35108 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=9, // byte at 35108 kBit/s, no coding
- PHY_HEADER_TIME=56, // 6 Phy Preamble at 35108 bits/s
- TIME_CORRECTION=11, // difference between txSFD and rxSFD: to do
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(message_header_t)*BYTE_TIME,
SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
// DEFAULT_SLEEP_TIME=1625,
! // DEFAULT_SLEEP_TIME=2048,
// DEFAULT_SLEEP_TIME=4096,
// DEFAULT_SLEEP_TIME=8192,
! DEFAULT_SLEEP_TIME=16384,
// DEFAULT_SLEEP_TIME=32768U,
// DEFAULT_SLEEP_TIME=65535U,
--- 139,155 ----
/**************** Module Global Constants *****************/
enum {
+ BYTE_TIME=ENCODED_32KHZ_BYTE_TIME, // phy encoded
+ PREAMBLE_BYTE_TIME=TDA5250_32KHZ_BYTE_TIME, // no coding
+ PHY_HEADER_TIME=6*PREAMBLE_BYTE_TIME, // 6 Phy Preamble
+ TIME_CORRECTION=TDA5250_32KHZ_BYTE_TIME+2, // difference between txSFD and rxSFD
+
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(message_header_t)*BYTE_TIME,
SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
// DEFAULT_SLEEP_TIME=1625,
! DEFAULT_SLEEP_TIME=2048,
// DEFAULT_SLEEP_TIME=4096,
// DEFAULT_SLEEP_TIME=8192,
! // DEFAULT_SLEEP_TIME=16384,
// DEFAULT_SLEEP_TIME=32768U,
// DEFAULT_SLEEP_TIME=65535U,
***************
*** 371,376 ****
(getHeader(msg)->type == teamgeistType)) {
if(rssiValue != INVALID_SNR) snr = rssiValue;
- rVal = signal Teamgeist.needsAck(msg, getHeader(msg)->src, getHeader(msg)->dest, snr);
*level = 2;
}
}
--- 366,371 ----
(getHeader(msg)->type == teamgeistType)) {
if(rssiValue != INVALID_SNR) snr = rssiValue;
*level = 2;
+ rVal = signal Teamgeist.needsAck(msg, getHeader(msg)->src, getHeader(msg)->dest, snr);
}
}
***************
*** 548,556 ****
bool isNewMsg(message_t* msg) {
! return call Duplicate.isNew(getHeader(msg)->src, (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
void rememberMsg(message_t* msg) {
! call Duplicate.remember(getHeader(msg)->src, (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
--- 543,554 ----
bool isNewMsg(message_t* msg) {
! return call Duplicate.isNew(getHeader(msg)->src,
! getHeader(msg)->dest,
! (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
void rememberMsg(message_t* msg) {
! call Duplicate.remember(getHeader(msg)->src, getHeader(msg)->dest,
! (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
***************
*** 578,581 ****
--- 576,580 ----
return lt;
}
+
/**************** Init ************************/
***************
*** 676,681 ****
}
else if(macState == RX_ACK) {
- // if(call RssiAdcResource.isOwner()) call ChannelMonitor.start();
- // sdDebug(132);
}
else if(macState == RX_ACK_P) {
--- 675,678 ----
***************
*** 861,865 ****
rxStat.repCounter = 0xff;
#endif
! // sdDebug(190);
if(macState == RX_P) {
// sdDebug(191);
--- 858,862 ----
rxStat.repCounter = 0xff;
#endif
! sdDebug(190);
if(macState == RX_P) {
// sdDebug(191);
***************
*** 895,906 ****
}
}
- #ifdef REDMAC_PERFORMANCE
else {
rxStat.duplicate = PERF_REPEATED_MSG;
}
- #endif
if(needsAckRx(msg, &level) && (action != RX)) {
- // sdDebug(197);
action = CCA_ACK;
}
else {
--- 892,905 ----
}
}
else {
+ #ifdef REDMAC_PERFORMANCE
rxStat.duplicate = PERF_REPEATED_MSG;
+ #endif
}
if(needsAckRx(msg, &level) && (action != RX)) {
action = CCA_ACK;
+ if(level == 2) {
+ getMetadata(msg)->ack = WAS_ACKED;
+ }
}
else {
***************
*** 1039,1044 ****
else if(macState == TX_ACK) {
checkCounter = 0;
! macState = RX;
! setRxMode();
// sdDebug(221);
#ifdef REDMAC_DEBUG
--- 1038,1045 ----
else if(macState == TX_ACK) {
checkCounter = 0;
! macState = SLEEP;
! setSleepMode();
! // macState = RX;
! // setRxMode();
// sdDebug(221);
#ifdef REDMAC_DEBUG
***************
*** 1054,1057 ****
--- 1055,1059 ----
rxTime = call LocalTime32kHz.get();
call ChannelMonitor.rxSuccess();
+ sdDebug(221);
}
}
***************
*** 1204,1210 ****
}
}
!
/****** SampleTimer ******************************/
-
async event void SampleTimer.fired() {
call SampleTimer.start(localSleeptime);
--- 1206,1211 ----
}
}
!
/****** SampleTimer ******************************/
async event void SampleTimer.fired() {
call SampleTimer.start(localSleeptime);
***************
*** 1327,1331 ****
atomic INCREASE_BACKOFF = value;
}
! async command void MacEval.addNav(bool value) {
atomic ADD_NAV = value;
}
--- 1328,1332 ----
atomic INCREASE_BACKOFF = value;
}
! async command void MacEval.addNav(uint8_t value) {
atomic ADD_NAV = value;
}
Index: CsmaMacP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/CsmaMacP.nc,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** CsmaMacP.nc 13 Feb 2008 10:32:15 -0000 1.15
--- CsmaMacP.nc 5 Mar 2008 11:20:43 -0000 1.16
***************
*** 77,81 ****
interface Alarm<T32khz, uint16_t> as Timer;
async command am_addr_t amAddress();
!
#ifdef MACM_DEBUG
interface GeneralIO as Led0;
--- 77,82 ----
interface Alarm<T32khz, uint16_t> as Timer;
async command am_addr_t amAddress();
! interface LocalTime<T32khz> as LocalTime32kHz;
!
#ifdef MACM_DEBUG
interface GeneralIO as Led0;
***************
*** 90,105 ****
enum {
- /*
- BYTE_TIME=21, // byte at 23405 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=14, // byte at 23405 kBit/s, no coding
- PHY_HEADER_TIME=84, // 6 Phy Preamble at 23405 bits/s
- TIME_CORRECTION=16, // difference between txSFD and rxSFD: 475us
- */
-
- BYTE_TIME=14, // byte at 35108 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=9, // byte at 35108 kBit/s, no coding
- PHY_HEADER_TIME=56, // 6 Phy Preamble at 35108 bits/s
- TIME_CORRECTION=11, // difference between txSFD and rxSFD: to do
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(tda5250_header_t)*BYTE_TIME,
SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
--- 91,101 ----
enum {
+ BYTE_TIME=ENCODED_32KHZ_BYTE_TIME, // phy encoded
+ PREAMBLE_BYTE_TIME=TDA5250_32KHZ_BYTE_TIME, // no coding
+ PHY_HEADER_TIME=6*PREAMBLE_BYTE_TIME, // 6 Phy Preamble
+ TIME_CORRECTION=TDA5250_32KHZ_BYTE_TIME+2, // difference between txSFD and rxSFD
+
+
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(tda5250_header_t)*BYTE_TIME,
SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
***************
*** 164,167 ****
--- 160,165 ----
uint16_t rssiValue = 0;
+
+ uint32_t rxTime = 0;
/****** debug vars & defs & functions ***********************/
***************
*** 387,395 ****
bool isNewMsg(message_t* msg) {
! return call Duplicate.isNew(getHeader(msg)->src, (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
void rememberMsg(message_t* msg) {
! call Duplicate.remember(getHeader(msg)->src, (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
--- 385,395 ----
bool isNewMsg(message_t* msg) {
! return call Duplicate.isNew(getHeader(msg)->src, getHeader(msg)->dest,
! (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
void rememberMsg(message_t* msg) {
! call Duplicate.remember(getHeader(msg)->src, getHeader(msg)->dest,
! (getHeader(msg)->token) & TOKEN_ACK_MASK);
}
***************
*** 669,672 ****
--- 669,673 ----
macState = RX_P;
signalMacState();
+ requestAdc();
}
else if(macState <= RX_ACK) {
***************
*** 783,786 ****
--- 784,788 ----
signalFailure(11);
}
+ post ReleaseAdcTask();
return m;
}
***************
*** 810,813 ****
--- 812,816 ----
signalFailure(13);
}
+ post ReleaseAdcTask();
}
***************
*** 954,958 ****
async event void RadioTimeStamping.receivedSFD( uint16_t time ) {
if(call RssiAdcResource.isOwner()) call ChannelMonitorData.getSnr();
! if(macState == RX_P) call ChannelMonitor.rxSuccess();
}
--- 957,964 ----
async event void RadioTimeStamping.receivedSFD( uint16_t time ) {
if(call RssiAdcResource.isOwner()) call ChannelMonitorData.getSnr();
! if(macState == RX_P) {
! rxTime = call LocalTime32kHz.get();
! call ChannelMonitor.rxSuccess();
! }
}
Index: CsmaMacC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/CsmaMacC.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CsmaMacC.nc 1 Oct 2007 17:58:07 -0000 1.7
--- CsmaMacC.nc 5 Mar 2008 11:20:43 -0000 1.8
***************
*** 62,65 ****
--- 62,66 ----
DuplicateC,
TimeDiffC,
+ LocalTimeC,
RandomLfsrC
#ifdef MAC_DEBUG
***************
*** 102,106 ****
CsmaMacP.Duplicate -> DuplicateC;
CsmaMacP.TimeDiff16 -> TimeDiffC;
!
#ifdef MAC_DEBUG
CsmaMacP.Led0 -> PlatformLedsC.Led0;
--- 103,108 ----
CsmaMacP.Duplicate -> DuplicateC;
CsmaMacP.TimeDiff16 -> TimeDiffC;
! CsmaMacP.LocalTime32kHz -> LocalTimeC;
!
#ifdef MAC_DEBUG
CsmaMacP.Led0 -> PlatformLedsC.Led0;
More information about the Tinyos-2-commits
mailing list