Commit graph

208 commits

Author SHA1 Message Date
adamdunkels cc2be0f111 Remove compiler warnings 2010-02-02 16:33:07 +00:00
adamdunkels 1a13d25d33 Revised version of the X-MAC implementation that uses a ctimer instead
of an rtimer for the periodic radio duty cycling. The benefit of this
implementation is that it leaves an rtimer free for user tasks. The
drawback is a slightly higher idle power consumption. This new version
is based on the current rtimer-based X-MAC.
2010-01-31 18:44:23 +00:00
adamdunkels e4168db633 Bugfix: deallocate queuebuf only if there was no collision 2010-01-31 13:55:36 +00:00
adamdunkels 2ae7ed827c Increase the default X-MAC channel check rate to 4 Hz instead of 2 Hz 2010-01-28 13:40:47 +00:00
adamdunkels 8430dab039 Typecast to fix nightly build problem 2010-01-27 07:36:31 +00:00
adamdunkels 4f3e8d565c Added a simple CSMA (Carrier Sense Multiple Access) mechanism that
works on top of an underlying duty cycling mechanism. The CSMA layer
retransmits packets that could not be sent because of a collision was
detected.
2010-01-25 11:46:44 +00:00
adamdunkels 7ad93e5d18 Added a field to the struct mac interface:
channel_check_interval(). This function returns the interval by which
the duty cycling mechanism checks the radio channel for activity. It
is used by higher layer mechanisms to determine suitable timeouts for
retransmissions.
2010-01-25 11:43:32 +00:00
adamdunkels 743e93e650 Do not remove encounters - there is no need to, as they are only an optimization 2010-01-14 20:14:03 +00:00
adamdunkels 2f105e933a Variable xmac_is_on was used both in interrupt and non-interrupt contexts and needs to be volatile 2009-12-06 23:29:38 +00:00
adamdunkels 53457eb1f0 Fixed compilation warning 2009-12-06 17:10:54 +00:00
adamdunkels 8bcc838d8a Bugfix: don't set the 'we are sending' flag until we are actually sending 2009-12-06 17:05:45 +00:00
adamdunkels 6897270289 Bugfix to the Contiki LPP encounter timing code: encounters are now
properly timed.
2009-12-06 13:18:32 +00:00
adamdunkels 822149f943 Significant improvements to the Contiki X-MAC:
* the code is simplified, particularly the duty cycling logic
* old unused code has been removed
* Contiki X-MAC now listens before sending a strobe to avoid MAC-level
  collisions
* broadcasts are sent directly, without strobes, reducing the power
  consumption of receivers
* turn off radio for 1 ms between sending a strobe and expecting the
  strobe ack
2009-12-06 13:16:59 +00:00
adamdunkels cef2e65c9b Added an error type for signalling a MAC-layer collision 2009-12-05 21:49:51 +00:00
adamdunkels 4a1a823a49 Code style fix 2009-12-05 13:29:41 +00:00
fros4943 a1b4597b95 fixed announcement compilation error 2009-11-27 14:27:50 +00:00
adamdunkels aeefa75304 Fixed alignment problems in announcement packet creation 2009-11-27 12:49:27 +00:00
fros4943 0034fd7bca generic return values for sent packet 2009-11-13 10:09:02 +00:00
fros4943 26bb5ecd21 added radio and MAC generic return values to allow applications finding out whether the packet was transmitted 2009-11-13 08:59:22 +00:00
adamdunkels 70fc23ac7e Enable stream mode by default, remove LED debug mode 2009-11-04 16:02:45 +00:00
adamdunkels 5aab2eb77d A simple addition with significant performance implications:
sicslowpan tags TCP packets with the PACKETBUF_ATTR_PACKET_TYPE_STREAM
flag, which makes the underlying power-saving MAC layer keep the radio
on for some time after transmitting the packet. This allows reply
packets to be processed directly, significantly increasing TCP latency
and throughput.
2009-11-02 11:58:56 +00:00
nifi 223fa1c8e5 added missing include 2009-10-20 07:42:03 +00:00
adamdunkels 7cdfbca973 Alignment problems with announcements fixed 2009-10-19 21:27:02 +00:00
adamdunkels 9ec57d61ad Added MAC layer framing support to X-MAC so that packets now are standard 802.15.4 frames 2009-10-19 20:53:56 +00:00
adamdunkels 4de1816e36 Added a new module called "framer" that creates MAC level frames to
the packetbuf from packet attributes. Two framer modules are included,
one that creates 802.15.4 frame headers, and one that creates a
minimal "nullmac"-style header that only contains the link-local
addresses.
2009-10-19 18:30:03 +00:00
nifi ae226c5917 * Set sender and receiver packet attributes on incoming packets
* Added link layer destination check
2009-10-19 11:25:54 +00:00
adamdunkels 10c873018d Ensure that DEFAULT_PERIOD is != 0, to avoid a modulo with 0 2009-10-19 06:39:29 +00:00
adamdunkels 9d26bd663e A new optimization to X-MAC: senders now keep track of when neighbors
last were known to be awake. When sending a packet, a sender does not
start to send strobes until the neighbor is expected to be awake. This
reduces power consumption for senders and decreases the contention in
the network as there are less packets in the air. Additionally, the
ACK optimization was improved so that data/ack exchanges now are
more efficient.
2009-10-18 13:19:25 +00:00
nifi 0ad51b8dcc Moved the link layer destination check to sicslowmac 2009-09-18 16:37:17 +00:00
adamdunkels 2181e90f69 Added the possibility to switch lpp off. Fixed sdcc compiler issue 2009-09-09 21:09:23 +00:00
adamdunkels 1cafbc6002 sdcc compiler issue fix: compound assignments are not supported, so we use memcpy() instead 2009-09-09 21:08:46 +00:00
nvt-se 4d21a3e203 Don't assume that radio->send turns on the radio automatically. 2009-09-04 10:59:30 +00:00
adamdunkels 522f991f14 Set sender and receiver packet attributes on incoming packets: patch by Gidon Ernst 2009-08-20 18:59:17 +00:00
nifi 912aba7280 added init function in MAC driver for easier configuration 2009-06-22 11:14:11 +00:00
nifi f39d2bd4c6 Fixed link panid for broadcasts to be standard compliant. Ignore packets addressed to other non-broadcast panids. 2009-05-26 12:08:29 +00:00
adamdunkels fe5a1f1068 Added an optimization option that avoids multiple simultaneous broadcasts from neighbors: when a broadcast is to be sent, a sender does not send until it knows that no other nodes are broadcasting. 2009-05-10 21:09:05 +00:00
adamdunkels 0adceb63b4 Code cleanup; made encounter optimization explicit; added optimization for adaptive off-time, but it currently seems to work bad with broadcasts 2009-05-06 15:06:38 +00:00
adamdunkels 9fff85757d Code cleanup; made strobe transmission time longer again (seems to work better in cooja?) 2009-05-06 15:05:28 +00:00
adamdunkels cc44e89415 Reduced default strobe time, which seems to work well. Avoid running the interrupt if the power-save feature is turned off (fixes problems with serial data reception on a gateway mote) 2009-04-29 11:42:13 +00:00
adamdunkels 81ef83b856 Added option to wait randomly before sending a packet. A few code cleanups. Avoid switching radio off when sending a packet with end-to-end acks, because an ACK may arrive shortly after the transmission. 2009-04-28 14:00:53 +00:00
nifi 84b38de494 removed bitfields for compatibility with cc65 2009-04-09 21:54:09 +00:00
nvt-se 03cd533712 made LISTEN_TIME and OFF_TIME configurable. 2009-04-07 11:29:08 +00:00
adamdunkels 5e456aea7d Added optimization for sending ACKs immediately. Turned optimizations on. Increased listening time to 1/64 s again due to problems with broadcasts with the 1/128 s setting 2009-04-06 22:50:35 +00:00
nifi 9f2ff48fda added 802.15.4 frame packeter 2009-04-06 13:19:03 +00:00
adamdunkels ed1e945e66 Added guard code so that OFF_TIME is never zero 2009-04-03 20:08:05 +00:00
adamdunkels 8dbd2b2337 Significant power consumption optimization: LPP now keeps track of encounters with neighbors and uses this information to keep the radio switched off longer. 2009-04-03 19:59:22 +00:00
adamdunkels 1d86b01bfb Made optimizations explicit (and configurable). Added missing initialization of dutycycle protothread. Reduced default listen time and off time. 2009-04-03 11:45:06 +00:00
adamdunkels 04101aae36 Fixed alignment problem on the MSP430, where the LPP header may be misaligned 2009-03-31 17:39:54 +00:00
nvt-se e2cc8b2a3e send all queued packet once we have the chance. 2009-03-31 14:44:13 +00:00
nvt-se 1d47e2a8da send immediate probes only if the packet is directed to us.
sleep for OFF_TIME if the queue is empty.

restrict double packet lifetime timeouts to unicast packets.

stop ctimer in remove_queued_packet in case the function is not called
via the ctimer callback. it could overwrite a valid packet otherwise.
2009-03-31 14:11:25 +00:00
nvt-se dd082f7fcf improvements to lpp based on code from Adam and discussions with Thiemo.
* queue multiple packets
* send a strobe back immediately after receiving a data packet
* double the packet lifetime to allow for a missed probe
2009-03-31 12:47:00 +00:00
nvt-se d8caaca289 listen time and off time parameters configurable from outside because cc1020 needs longer listen time. 2009-03-26 12:50:57 +00:00
adamdunkels ec1677ca6c Added a function (quick hack) that sets the radio transmission power of outgoing announcement packets in xmac 2009-03-23 21:06:26 +00:00
adamdunkels 1cbc0f4ea9 Send announcement packets only if there are any announcements to send 2009-03-23 21:00:25 +00:00
adamdunkels 65eb5fd4e8 Renamed the rimebuf module to packetbuf to signal that the module is used outside of a pure Rime context (e.g., the sicslowpan code uses it). 2009-03-12 21:58:20 +00:00
adamdunkels dc7491f810 Bugfix and optimization: X-MAC did not properly switch the radio off after sending a packet, resulting in increased power consumption. For packets that require an ACK, we can let the radio be on in anticipation of the ACK (controlled with an WITH_ACK_OPTIMIZATION option) 2009-03-05 19:37:52 +00:00
adamdunkels d813d343c5 Cleaned up old left-over code 2009-03-01 20:38:57 +00:00
adamdunkels 7010eb84b8 Added support for communication power accounting. Energy is attributed to idle listening when the radio is switched off. Enegrgy is attributed to an incoming packet when it is received. Energy is attributed to an outgoing packet when it is transmitted. 2009-03-01 20:37:16 +00:00
adamdunkels e6907a1d8b Include random.h 2009-02-20 21:22:39 +00:00
adamdunkels aaa8c9d2c9 Construct the X-MAC header on the stack instead of directly in the packet header, because the packet header may be misaligned. A bit of cleanup in the code too. 2009-02-15 22:05:06 +00:00
adamdunkels e4b1ff461e Added MAC-layer announcement beacons to X-MAC. Configuratble through XMAC_CONF_ANNOUNCEMENTS 2009-02-14 20:35:03 +00:00
adamdunkels 585620c102 Reverted the recent change from random_rand() to rand(). It turned out that
since libc rand() returns a signed int, there were frequently problems with
timer values wrapping. By reverting to random_rand(), we can provide a
random generator that returns an unsigned and the timer problems are solved.
2009-02-11 11:08:53 +00:00
adamdunkels dd9ffd87c4 Added missing #include announcement.h 2009-02-08 20:14:18 +00:00
adamdunkels 085df6b630 Improved version of LPP with support for broadcasts as well as announcement data in the probes 2009-02-08 19:30:18 +00:00
adamdunkels 91d280c4c9 Reverted to the old behaviour on broadcasts: send strobes for both unicast and broadcast packets. 2009-02-07 18:45:50 +00:00
fros4943 e42d572f81 updated for latest mac driver structure 2008-11-12 12:42:41 +00:00
adamdunkels 7b238a91af Don't turn on the radio on after sending a broadcast 2008-09-04 17:44:01 +00:00
adamdunkels c0c26262c4 No need to send strobes for broadcast packets: just send the actual packet instead 2008-07-07 23:25:12 +00:00
adamdunkels 05454ce929 Documentation bugfix 2008-07-02 14:10:28 +00:00
adamdunkels 1093a8fe28 Added name to mac structure. Do not turn radio on when sending a broadcast packet. Changed default off time to half a second. 2008-06-30 08:10:02 +00:00
adamdunkels 247de015b5 added name to mac structure 2008-06-30 08:09:17 +00:00
adamdunkels c9528fb010 Added name, made default listen time shorter 2008-06-30 08:08:59 +00:00
adamdunkels a7dfa95551 Added a 'name' field in the mac structure, which allows boot-up code to print out the name of the currently selected MAC protocol 2008-06-30 08:08:27 +00:00
oliverschmidt a5fcfa2787 I seem to remember that we wanted to avoid ignoring gcc warnings that might trigger errors with other compilers ;-) 2008-05-16 21:31:57 +00:00
adamdunkels 532692e5a0 Removed reference to non-existant function rimebuf_attr_isset() 2008-05-16 15:04:10 +00:00
adamdunkels 8ea461b039 Changed on time to work with the current default tick time on the sky platform 2008-05-15 08:59:48 +00:00
adamdunkels dbab9fbdb5 A quick, initial implementation of the LPP power-saving MAC protocol (Musaloiu-E et al, IPSN 2008) 2008-05-15 08:56:29 +00:00
adamdunkels 412facb831 This is an initial commit of an implementation of the Chameleon
architecture for the Rime stack for Contiki. The Chameleon
architecture separates the header processing from the Rime protocol
logic. Instead of having each protocol create its own part of the
packet header, protocols use packet attributes. Before sending a
packet, a special Chameleon header processing module creates a packet
header from the packet attributes. The same Chameleon module parses
incoming packets and creates packet attributes from the header.

The details are in our SenSys 2007 paper:

Adam Dunkels, Fredrik Osterlind, Zhitao He. An Adaptive Communication
Architecture for Wireless Sensor Networks. In Proceedings of the Fifth
ACM Conference on Networked Embedded Sensor Systems (SenSys 2007),
Sydney, Australia, November 2007.

http://www.sics.se/~adam/dunkels07adaptive.pdf

This is a rewrite of the code that was developed for the paper.
2008-02-25 02:14:34 +00:00
adamdunkels 974870359a Changed all occurences of u8_t and u16_t to uint8_t and uint16_t 2008-02-24 22:10:30 +00:00
adamdunkels be1dd57cb3 Stopping watchdog before sending packets to allow for wait times longer than 1 second. Reduced default on time to 5 ms. Added option for turning off X-MAC but keeping the radio turned on. 2008-02-24 21:07:28 +00:00
adamdunkels 32a3fa5d4a Added parameter to the mac off() method that specifies whether or not the radio should be turned off when the MAC layer is turned off 2008-02-24 21:05:28 +00:00
adamdunkels bf8b5c093d Made timetable code optional 2008-01-24 06:17:51 +00:00
adamdunkels 8a9b931a4b Rewrote most of the X-MAC code to make it easier to follow, debug and modify. Also added an optional, experimental time synchronized addition that makes X-MACs on different nodes explicitly de-synchronized 2008-01-23 15:00:54 +00:00
adamdunkels bd125aaac6 Changed the code so that the rtimer is only set from the rtimer (interrupt) code, and not from the non-rtimer code. Removed unused code that was supposed to turn the radio off when a packet for another node was heard (but which didn't really work anyway). Changed default on time to 1/100 seconds, and off time to 1/2 seconds 2008-01-14 09:26:42 +00:00
oliverschmidt a9ebc469b8 Avoid usage of POSIX function names even for static functions as some indirectly included system header might declare them. 2007-12-23 14:56:54 +00:00
adamdunkels 5c5775e93b Ensure that receiver_callback is set before calling it 2007-12-16 14:31:43 +00:00
adamdunkels 18fd561041 Avoid switching the radio on and off when the MAC layer is turned off. Cleanups. 2007-12-05 13:23:17 +00:00
adamdunkels 52a8e8d16b Fixed to match the Contiki code style 2007-11-26 15:31:32 +00:00
adamdunkels 5e7cbff22a Fixed compiler warnings 2007-11-17 10:12:19 +00:00
adamdunkels 1cb3bad088 Multiple bugfixes and updates to xmac code by Niclas 2007-11-12 22:29:37 +00:00
adamdunkels 67aa9e8589 Made initialization function return a pointer to the MAC driver structure, to make initialization nicer 2007-10-23 21:27:57 +00:00
adamdunkels f638c628d7 Made initialization function return a pointer to the MAC driver structure, to make initialization nicer 2007-10-23 20:57:37 +00:00
fros4943 aa99049af0 simple tdma rtimer implemetation 2007-09-18 10:37:17 +00:00
fros4943 19b3035e36 simple tdma ctimer implementation 2007-09-18 10:36:36 +00:00
fros4943 25d2514541 xmac ctimer implementation 2007-09-18 10:35:39 +00:00
fros4943 858e2682e6 platform independent simple slotted tdma mac protocol
observe: uses event timers, not real-time timers!
2007-08-31 13:42:22 +00:00
matsutsuka 9d4fc0a1a8 Support for z80(sdcc) port.
In order to support, some core modules are modified as follows:

core/sys/dsc.h
- If CTK_CONF_ICONS is diabled, the whole icon-related code is disabled.
- DSC_HEADER is changed to remove extra semicolon.

core/sys/process.h
- process_data_t is expressed by void* in signatures (known bug on sdcc).

core/sys/autostart.h
- autostart_processes is changed to remove extra semicolon.

core/sys/cc.h
- CC_CONF_ASSIGN_AGGREGATE is introduced.
- CC_CONF_INC_CAST_POINTER is introduced, a workaround of a kind
  of sdcc bug for an increment.

core/net/hc.c
core/net/uip_arp.c
core/net/uaodv.c
- Aggregation assignments are changed to uip_ipaddr_copy.

core/net/psock.c
core/net/uipbuf.c
core/net/dhcpc.c
apps/shell/shell.c
core/ctk/vnc-server.c
core/ctk/vnc-out.c
- "register" keyword in a signature cannot be used in sdcc,
  CC_REGISTER_ARG is used instead.

core/net/uip-over-mesh.c
- An extra semicolon is removed.

apps/dhcp/dhcp-dsc.c
apps/shell/shell-dsc.
apps/ftp/ftp-dsc.c
apps/process-list/process-list-dsc.c
apps/email/email-dsc.c
apps/webserver/webserver-dsc.c
apps/vnc/vnc-dsc.c
apps/vnc/vnc-viewer.h
apps/webbrowser/www-dsc.c
apps/about/about-dsc.c
apps/irc/irc-dsc.c
apps/telnet/telnet-dsc.c
apps/telnetd/telnetd-dsc.c
apps/netconf/netconf-dsc.c
apps/directory/directory-dsc.c
pps/calc/calc-dsc.c
- Modify an extern type to a real declaration, which is static
  to prevent a compile error.

core/net/mac/xmac.c
- Variables cannot be defined in a head of block on sdcc.

core/ctk/ctk.h
core/ctk/ctk.c
apps/program-handler/program-handler.c
- If CTK_CONF_ICONS is diabled, the whole icon-related code is disabled.

Makefile.include
- Add a set of configuration for an assembler.
- $(CLEAN) variable is introduced for customized cleanup.

apps/process-list/process-list.c
- PROCESSLIST_CONF_HEIGHT is introduced to address smaller screen size.

core/lib/ctk-filedialog.c
- FILES_CONF_HEIGHT is introduced to address smaller screen size.
- "register" keyword in a signature cannot be used in sdcc,
  CC_REGISTER_ARG is used instead.

apps/vnc/vnc-viewer.c
- A cast is added to prevent a compile error.
- "register" keyword in a signature cannot be used in sdcc,
  CC_REGISTER_ARG is used instead.

apps/webbrowser/webclient.c
- CC_CONF_INC_CAST_POINTER is introduced, a workaround of a kind
  of sdcc bug for an increment.

core/loader/elfloader.c
- A cast is added to prevent a compile error.

core/net/rime/rimeaddr.c
- An initialization is added to prevent a compile error.

core/net/rime/rudolph0.c
- NULL is changed to 0, because NULL causes a compile error.

core/net/rime/route-discovery.c
- Add an argument to match the definition of nf_callbacks.

cpu/z80/strcasecmp.h
cpu/z80/strcasecmp.c
cpu/z80/contiki-sdcc-conf.h
cpu/z80/mtarch.c
cpu/z80/mtarch.h
cpu/z80/Makefile.z80
- New files to make compilation availble on sdcc.
- Added support for multithreading.
2007-08-30 14:39:16 +00:00
adamdunkels 52eb372890 Modified to use the new MAC layer API 2007-05-25 08:06:44 +00:00
adamdunkels b07cfde31b Generic API for MAC layers 2007-05-25 06:40:19 +00:00
oliverschmidt 7904a7e294 Made it compile again. 2007-05-22 22:10:30 +00:00
adamdunkels edd509acf5 Added nicer configuration options. Added hack for optimizing X-MAC for unicast packets. Added statistics gathering. Turn radio off when someone else is receiving a packet. Queueing packets when X-MAC cannot send immediately (since someone else is transmitting). 2007-05-22 20:55:24 +00:00
oliverschmidt c15984eb24 Avoid function pointer mismatch in set_receive_function(). 2007-05-19 13:19:22 +00:00
oliverschmidt 0e9c61ca0c The PT_* macros contain return statements so a function using them must return a value. 2007-05-19 13:12:00 +00:00
adamdunkels 18825e05b6 Strobes for unicast packets are now acked immediately. Sleep cycle is now configurable. Many bugfixes 2007-05-15 08:07:07 +00:00
adamdunkels 434a6376d7 Added nullmac 2007-05-15 08:06:07 +00:00
adamdunkels 5728570aa4 A 'null' MAC protocol that does not do anything 2007-05-15 07:40:22 +00:00
adamdunkels 336246f406 Makefile 2007-04-07 05:43:52 +00:00
adamdunkels d335cb8087 Power saving MAC protocol based on X-MAC [SenSys 2006] 2007-04-07 05:43:31 +00:00