X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Ftda5250%2Fmac%2FCsmaMacP.nc;h=e612c2f5ee039fba77bf56c88eac8858e6a62d00;hb=e714e397b4edbe93882af65c4cb3014ceb477fe9;hp=28de91414a2145e3e98d880136962514a85b774c;hpb=337d0b13acf569c2640b3ed7b7f5c7cec35d7ddd;p=tinyos-2.x.git diff --git a/tos/chips/tda5250/mac/CsmaMacP.nc b/tos/chips/tda5250/mac/CsmaMacP.nc index 28de9141..e612c2f5 100644 --- a/tos/chips/tda5250/mac/CsmaMacP.nc +++ b/tos/chips/tda5250/mac/CsmaMacP.nc @@ -50,7 +50,6 @@ module CsmaMacP { interface MacSend; interface MacReceive; interface Packet; - interface McuPowerOverride; } uses { interface StdControl as CcaStdControl; @@ -88,18 +87,19 @@ implementation { 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=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 38400 kBit/s with 4b6b encoding + SUB_FOOTER_TIME=2*BYTE_TIME, // 2 bytes crc 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 + 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 + 19 + 2*ADDED_DELAY, - TX_GAP_TIME=RX_ACK_TIMEOUT + TX_SETUP_TIME + 11, + 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, BACKOFF_MASK=0xFFF, // minimum time around one packet time @@ -107,8 +107,8 @@ implementation TOKEN_ACK_FLAG = 64, TOKEN_ACK_MASK = 0x3f, INVALID_SNR = 0xffff, - MSG_TABLE_ENTRIES=20, - MAX_AGE=2*MAX_LONG_RETRY*MAX_SHORT_RETRY, + MSG_TABLE_ENTRIES=16, + MAX_AGE=0xff, }; /**************** Module Global Variables *****************/ @@ -167,7 +167,7 @@ implementation unsigned i; atomic { for(i = 0; i < MSG_TABLE_ENTRIES; i++) { - if(knownMsgTable[i].age <= MAX_AGE) ++knownMsgTable[i].age; + if(knownMsgTable[i].age < MAX_AGE) ++knownMsgTable[i].age; } } } @@ -328,10 +328,10 @@ implementation restLaufzeit = restLaufzeit - now; } else { - restLaufzeit += MAXTIMERVALUE - now; + restLaufzeit = (uint16_t)(-1) - restLaufzeit + now; } if(restLaufzeit > BACKOFF_MASK) { - restLaufzeit = backoff(0); + restLaufzeit = call Random.rand16() & 0xFF; } setFlag(&flags, RESUME_BACKOFF); } @@ -1012,11 +1012,6 @@ implementation // we don't care about urgent Resource requestes async event void RadioResourceRequested.immediateRequested() {} - - /** prevent MCU from going into a too low power mode */ - async command mcu_power_t McuPowerOverride.lowestState() { - return MSP430_POWER_LPM1; - } }