[Tinyos-2-commits]
CVS: tinyos-2.x/tos/chips/tda5250/mac RedMacP.nc, 1.6,
1.7 RedMacC.nc, 1.4, 1.5 CsmaMacP.nc, 1.7, 1.8
akoepke
andreaskoepke at users.sourceforge.net
Wed Apr 4 23:38:48 PDT 2007
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX/byte_radio
UartManchPhyP.nc, 1.5, 1.6 Uart4b6bPhyP.nc, 1.4,
1.5 Uart4b6bPhyC.nc, 1.2, 1.3
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/byte_radio
PacketSerializerP.nc, 1.4, 1.5 MacReceive.nc, 1.2,
1.3 LinkLayerP.nc, 1.3, 1.4 LinkLayerC.nc, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7090/chips/tda5250/mac
Modified Files:
RedMacP.nc RedMacC.nc CsmaMacP.nc
Log Message:
switch to metric MHz for SMCLK, adjust constants, include SmclkManager
reduce baud rate for radio -- it can not handle more than 23kBit/s with a
50kHz frequency shift
Index: RedMacP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/RedMacP.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RedMacP.nc 14 Mar 2007 15:52:18 -0000 1.6
--- RedMacP.nc 5 Apr 2007 06:38:45 -0000 1.7
***************
*** 75,78 ****
--- 75,84 ----
interface Counter<T32khz,uint16_t> as Counter32khz16;
async command am_addr_t amAddress();
+ /*
+ interface GeneralIO as Led0;
+ interface GeneralIO as Led1;
+ interface GeneralIO as Led2;
+ interface GeneralIO as Led3;
+ */
#ifdef REDMAC_DEBUG
interface SerialDebug;
***************
*** 104,107 ****
--- 110,114 ----
call SerialDebug.putPlace(p);
}
+ uint8_t repCounter;
#else
void sdDebug(uint16_t p) {};
***************
*** 110,128 ****
/**************** Module Global Constants *****************/
enum {
- /*
- BYTE_TIME=13, // byte at 38400 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=9, // byte at 38400 kBit/s, no coding
- PHY_HEADER_TIME=51, // 6 Phy Preamble at 38400
- */
- BYTE_TIME=10, // byte at 49000 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=7, // byte at 49000 kBit/s, no coding
- PHY_HEADER_TIME=40, // 6 Phy Preamble at 49000
! /*
! BYTE_TIME=12, // byte at 40960 kBit/s, 4b6b encoded
! PREAMBLE_BYTE_TIME=8, // byte at 40960 kBit/s, no coding
! PHY_HEADER_TIME=48, // 6 Phy Preamble at 40960
! */
! SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(tda5250_header_t)*BYTE_TIME,
SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
// DEFAULT_SLEEP_TIME=1625,
--- 117,127 ----
/**************** 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=15, // difference between sendSFD and rxSFD, to do: measure!
!
! 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,
***************
*** 131,153 ****
// DEFAULT_SLEEP_TIME=9750,
DEFAULT_SLEEP_TIME=16384,
DATA_DETECT_TIME=17,
! RX_SETUP_TIME=111, // time to set up receiver
! TX_SETUP_TIME=69, // time to set up transmitter
! ADDED_DELAY = PREAMBLE_BYTE_TIME,
! RX_ACK_TIMEOUT = RX_SETUP_TIME + PHY_HEADER_TIME + 2*ADDED_DELAY + 19,
! TX_GAP_TIME=RX_ACK_TIMEOUT + TX_SETUP_TIME + 11,
// the duration of a send ACK
ACK_DURATION = SUB_HEADER_TIME + SUB_FOOTER_TIME,
! MAX_SHORT_RETRY=7,
! MAX_LONG_RETRY=2,
MAX_AGE=2*MAX_LONG_RETRY*MAX_SHORT_RETRY,
MSG_TABLE_ENTRIES=20,
TOKEN_ACK_FLAG = 64,
TOKEN_ACK_MASK = 0x3f,
- /* correct the difference between the transmittedSFD and the receivedSFD
- that appears due to buffering, measured value on an osci is 320us, so this
- value is actually 10.48576
- */
- TIME_CORRECTION = 10,
INVALID_SNR = 0xffff,
// PREAMBLE_LONG = 5,
--- 130,148 ----
// DEFAULT_SLEEP_TIME=9750,
DEFAULT_SLEEP_TIME=16384,
+ // DEFAULT_SLEEP_TIME=32768U,
DATA_DETECT_TIME=17,
! RX_SETUP_TIME=102, // time to set up receiver
! TX_SETUP_TIME=58, // time to set up transmitter
! ADDED_DELAY = 30,
! RX_ACK_TIMEOUT = RX_SETUP_TIME + PHY_HEADER_TIME + ADDED_DELAY + 30,
! TX_GAP_TIME = RX_ACK_TIMEOUT + TX_SETUP_TIME + 33,
// the duration of a send ACK
ACK_DURATION = SUB_HEADER_TIME + SUB_FOOTER_TIME,
! MAX_SHORT_RETRY=9,
! MAX_LONG_RETRY=1,
MAX_AGE=2*MAX_LONG_RETRY*MAX_SHORT_RETRY,
MSG_TABLE_ENTRIES=20,
TOKEN_ACK_FLAG = 64,
TOKEN_ACK_MASK = 0x3f,
INVALID_SNR = 0xffff,
// PREAMBLE_LONG = 5,
***************
*** 293,306 ****
setRxMode();
}
! else {
! if(txBufPtr) sdDebug(41);
! if(shortRetryCounter) sdDebug(42);
! if(isFlagSet(&flags, MESSAGE_PREPARED)) sdDebug(43);
if(txBufPtr) {
! if(macState == SLEEP) sdDebug(44);
! if(!isFlagSet(&flags, RESUME_BACKOFF)) sdDebug(45);
! if(!call Timer.isRunning()) sdDebug(46);
}
}
}
--- 288,302 ----
setRxMode();
}
! /* else {
! if(txBufPtr) // sdDebug(41);
! if(shortRetryCounter) // sdDebug(42);
! if(isFlagSet(&flags, MESSAGE_PREPARED)) // sdDebug(43);
if(txBufPtr) {
! if(macState == SLEEP) // sdDebug(44);
! if(!isFlagSet(&flags, RESUME_BACKOFF)) // sdDebug(45);
! if(!call Timer.isRunning()) // sdDebug(46);
}
}
+ */
}
***************
*** 416,421 ****
clearFlag(&flags, CANCEL_SEND);
}
! sdDebug(3000 + e);
! sdDebug(4000 + getHeader(m)->type);
signal MacSend.sendDone(m, e);
}
--- 412,417 ----
clearFlag(&flags, CANCEL_SEND);
}
! // sdDebug(3000 + e);
! // sdDebug(4000 + getHeader(m)->type);
signal MacSend.sendDone(m, e);
}
***************
*** 427,431 ****
shortRetryCounter = 1;
if(longRetryCounter > MAX_LONG_RETRY) {
! sdDebug(60);
signalSendDone(FAIL);
}
--- 423,427 ----
shortRetryCounter = 1;
if(longRetryCounter > MAX_LONG_RETRY) {
! // sdDebug(60);
signalSendDone(FAIL);
}
***************
*** 439,443 ****
shortRetryCounter = 1;
if(longRetryCounter > MAX_LONG_RETRY) {
! sdDebug(70);
signalSendDone(FAIL);
} else {
--- 435,439 ----
shortRetryCounter = 1;
if(longRetryCounter > MAX_LONG_RETRY) {
! // sdDebug(70);
signalSendDone(FAIL);
} else {
***************
*** 535,538 ****
--- 531,537 ----
getHeader(&ackMsg)->dest = getHeader(msg)->src;
getHeader(&ackMsg)->type = getHeader(msg)->type;
+ #ifdef REDMAC_DEBUG
+ repCounter = ((red_mac_header_t *)call SubPacket.getPayload(msg, NULL))->repetitionCounter;
+ #endif
}
***************
*** 721,725 ****
async event void RadioModes.SleepModeDone() {
! sdDebug(160);
atomic {
clearFlag(&flags, SWITCHING);
--- 720,724 ----
async event void RadioModes.SleepModeDone() {
! // sdDebug(160);
atomic {
clearFlag(&flags, SWITCHING);
***************
*** 729,733 ****
if(congestionLevel > 0) congestionLevel--;
}
! if(congestionLevel > 3) sdDebug(2000 + congestionLevel);
if(macState == SLEEP) {
// sdDebug(161);
--- 728,732 ----
if(congestionLevel > 0) congestionLevel--;
}
! // if(congestionLevel > 3) // sdDebug(2000 + congestionLevel);
if(macState == SLEEP) {
// sdDebug(161);
***************
*** 764,768 ****
if((shortRetryCounter == 0) && (txBufPtr == NULL)) {
clearFlag(&flags, MESSAGE_PREPARED);
! sdDebug(5000 + getHeader(msg)->type);
shortRetryCounter = 1;
longRetryCounter = 1;
--- 763,767 ----
if((shortRetryCounter == 0) && (txBufPtr == NULL)) {
clearFlag(&flags, MESSAGE_PREPARED);
! // sdDebug(5000 + getHeader(msg)->type);
shortRetryCounter = 1;
longRetryCounter = 1;
***************
*** 787,807 ****
atomic {
if(msg == txBufPtr) {
! sdDebug(320);
setFlag(&flags, CANCEL_SEND);
shortRetryCounter = MAX_SHORT_RETRY + 2;
longRetryCounter = MAX_LONG_RETRY + 2;
if(macState == SLEEP) {
! sdDebug(321);
signalSendDone(ECANCEL);
}
else {
! sdDebug(322);
}
! sdDebug(1000 + macState);
err = SUCCESS;
}
else {
! sdDebug(323);
! sdDebug(1100 + macState);
}
}
--- 786,806 ----
atomic {
if(msg == txBufPtr) {
! // sdDebug(320);
setFlag(&flags, CANCEL_SEND);
shortRetryCounter = MAX_SHORT_RETRY + 2;
longRetryCounter = MAX_LONG_RETRY + 2;
if(macState == SLEEP) {
! // sdDebug(321);
signalSendDone(ECANCEL);
}
else {
! // sdDebug(322);
}
! // sdDebug(1000 + macState);
err = SUCCESS;
}
else {
! // sdDebug(323);
! // sdDebug(1100 + macState);
}
}
***************
*** 858,862 ****
}
}
! (getMetadata(msg))->time = calcGeneratedTime((red_mac_header_t*) payload);
m = signal MacReceive.receiveDone(msg);
// assume a buffer swap -- if buffer is not swapped, assume that the
--- 857,862 ----
}
}
! getMetadata(msg)->time = calcGeneratedTime((red_mac_header_t*) payload);
! getMetadata(msg)->ack = WAS_NOT_ACKED;
m = signal MacReceive.receiveDone(msg);
// assume a buffer swap -- if buffer is not swapped, assume that the
***************
*** 925,930 ****
getMetadata(txBufPtr)->strength);
}
! sdDebug(203);
signalSendDone(SUCCESS);
action = SLEEP;
}
--- 925,931 ----
getMetadata(txBufPtr)->strength);
}
! // sdDebug(203);
signalSendDone(SUCCESS);
+ // sdDebug(30000 + getHeader(msg)->src);
action = SLEEP;
}
***************
*** 936,940 ****
else {
if(call Timer.isRunning()) {
! // sdDebug(204);
action = RX_ACK;
}
--- 937,941 ----
else {
if(call Timer.isRunning()) {
! sdDebug(204);
action = RX_ACK;
}
***************
*** 951,957 ****
}
if(action == CCA_ACK) {
- prepareAck(msg);
macState = CCA_ACK;
! call Timer.start(RX_SETUP_TIME - TX_SETUP_TIME + (ADDED_DELAY>>level));
}
else if(action == RX_ACK) {
--- 952,964 ----
}
if(action == CCA_ACK) {
macState = CCA_ACK;
! if(call Random.rand16() & 2) {
! call Timer.start(RX_SETUP_TIME - TX_SETUP_TIME + 16 - level*8 + ADDED_DELAY);
! }
! else {
! macState = TX_ACK;
! call Timer.start(RX_SETUP_TIME - TX_SETUP_TIME + 16);
! }
! prepareAck(msg);
}
else if(action == RX_ACK) {
***************
*** 970,974 ****
else {
setFlag(&flags, RESUME_BACKOFF);
! restLaufzeit = nav + backoff(longRetryCounter);
}
setSleepMode();
--- 977,981 ----
else {
setFlag(&flags, RESUME_BACKOFF);
! restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
}
setSleepMode();
***************
*** 985,992 ****
async event void PacketSend.sendDone(message_t* msg, error_t error) {
if(macState == TX) {
- // sdDebug(220);
macState = RX_ACK;
setRxMode();
call Timer.start(RX_ACK_TIMEOUT);
checkCounter = 0;
}
--- 992,999 ----
async event void PacketSend.sendDone(message_t* msg, error_t error) {
if(macState == TX) {
macState = RX_ACK;
setRxMode();
call Timer.start(RX_ACK_TIMEOUT);
+ sdDebug(220);
checkCounter = 0;
}
***************
*** 995,998 ****
--- 1002,1009 ----
macState = RX;
setRxMode();
+ sdDebug(221);
+ #ifdef REDMAC_DEBUG
+ // sdDebug(40000U + repCounter);
+ #endif
}
}
***************
*** 1085,1088 ****
--- 1096,1100 ----
macState = TX_ACK;
setTxMode();
+ sdDebug(20000 + getHeader(&ackMsg)->dest);
}
}
***************
*** 1104,1108 ****
else if(macState == RX_ACK) {
if(prepareRepetition()) {
! // sdDebug(253);
macState = TX;
setTxMode();
--- 1116,1120 ----
else if(macState == RX_ACK) {
if(prepareRepetition()) {
! sdDebug(253);
macState = TX;
setTxMode();
***************
*** 1110,1114 ****
else {
if(needsAckTx(txBufPtr)) {
! // sdDebug(254);
updateLongRetryCounters();
}
--- 1122,1126 ----
else {
if(needsAckTx(txBufPtr)) {
! sdDebug(254);
updateLongRetryCounters();
}
***************
*** 1121,1124 ****
--- 1133,1140 ----
}
}
+ else if(macState == TX_ACK) {
+ setTxMode();
+ sdDebug(10000 + getHeader(&ackMsg)->dest);
+ }
else if(macState == SLEEP) {
if(isFlagSet(&flags, SWITCHING)) {
***************
*** 1264,1268 ****
default async event void ChannelCongestion.congestionEvent(uint8_t level) {}
!
/***** unused Radio Modes events **************************/
--- 1280,1284 ----
default async event void ChannelCongestion.congestionEvent(uint8_t level) {}
!
/***** unused Radio Modes events **************************/
Index: RedMacC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/RedMacC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RedMacC.nc 10 Mar 2007 22:14:21 -0000 1.4
--- RedMacC.nc 5 Apr 2007 06:38:45 -0000 1.5
***************
*** 96,101 ****
RedMacP.SampleTimer -> SampleTimer;
RedMacP.Counter32khz16 -> Counter;
! /*
! components PlatformLedsC;
RedMacP.Led0 -> PlatformLedsC.Led0;
RedMacP.Led1 -> PlatformLedsC.Led1;
--- 96,101 ----
RedMacP.SampleTimer -> SampleTimer;
RedMacP.Counter32khz16 -> Counter;
!
! /* components PlatformLedsC;
RedMacP.Led0 -> PlatformLedsC.Led0;
RedMacP.Led1 -> PlatformLedsC.Led1;
Index: CsmaMacP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/CsmaMacP.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CsmaMacP.nc 10 Mar 2007 22:11:14 -0000 1.7
--- CsmaMacP.nc 5 Apr 2007 06:38:45 -0000 1.8
***************
*** 88,116 ****
enum {
! /*
! BYTE_TIME=13, // byte at 38400 kBit/s, 4b6b encoded
! PREAMBLE_BYTE_TIME=9, // byte at 38400 kBit/s, no coding
! PHY_HEADER_TIME=51, // 6 Phy Preamble at 38400
! */
- BYTE_TIME=10, // byte at 49000 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=7, // byte at 49000 kBit/s, no coding
- PHY_HEADER_TIME=40, // 6 Phy Preamble at 49000
-
- /*
- BYTE_TIME=12, // byte at 40960 kBit/s, 4b6b encoded
- PREAMBLE_BYTE_TIME=8, // byte at 40960 kBit/s, no coding
- PHY_HEADER_TIME=48, // 6 Phy Preamble at 40960
- */
-
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(tda5250_header_t)*BYTE_TIME,
! SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc 38400 kBit/s with 4b6b encoding
MAXTIMERVALUE=0xFFFF, // helps to compute backoff
DATA_DETECT_TIME=17,
! RX_SETUP_TIME=111, // time to set up receiver
! TX_SETUP_TIME=69, // time to set up transmitter
ADDED_DELAY = 30,
! RX_ACK_TIMEOUT=RX_SETUP_TIME + PHY_HEADER_TIME + 19 + 2*ADDED_DELAY,
! TX_GAP_TIME=RX_ACK_TIMEOUT + TX_SETUP_TIME + 11,
MAX_SHORT_RETRY=7,
MAX_LONG_RETRY=4,
--- 88,104 ----
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
SUB_HEADER_TIME=PHY_HEADER_TIME + sizeof(tda5250_header_t)*BYTE_TIME,
! SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc
MAXTIMERVALUE=0xFFFF, // helps to compute backoff
DATA_DETECT_TIME=17,
! RX_SETUP_TIME=102, // time to set up receiver
! TX_SETUP_TIME=58, // time to set up transmitter
ADDED_DELAY = 30,
! RX_ACK_TIMEOUT=RX_SETUP_TIME + PHY_HEADER_TIME + 2*ADDED_DELAY,
! TX_GAP_TIME=RX_ACK_TIMEOUT + TX_SETUP_TIME + 33,
MAX_SHORT_RETRY=7,
MAX_LONG_RETRY=4,
***************
*** 341,348 ****
}
else {
! restLaufzeit += MAXTIMERVALUE - now;
}
if(restLaufzeit > BACKOFF_MASK) {
! restLaufzeit = backoff(0);
}
setFlag(&flags, RESUME_BACKOFF);
--- 329,336 ----
}
else {
! restLaufzeit = (uint16_t)(-1) - restLaufzeit + now;
}
if(restLaufzeit > BACKOFF_MASK) {
! restLaufzeit = call Random.rand16() & 0xFF;
}
setFlag(&flags, RESUME_BACKOFF);
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX/byte_radio
UartManchPhyP.nc, 1.5, 1.6 Uart4b6bPhyP.nc, 1.4,
1.5 Uart4b6bPhyC.nc, 1.2, 1.3
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/byte_radio
PacketSerializerP.nc, 1.4, 1.5 MacReceive.nc, 1.2,
1.3 LinkLayerP.nc, 1.3, 1.4 LinkLayerC.nc, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list