Commit graph

54 commits

Author SHA1 Message Date
nifi c20047f657 Changed the network stack to use different structures for the different layers (network_driver, mac_driver, rdc_driver, radio_driver). This helps to avoid incorrect configuration. 2010-02-23 20:09:11 +00:00
adamdunkels e34eb54960 A work-in-progress rework of the Contiki MAC and radio layers. The
main ideas are:

* Separates the Contiki low-layer network stack into four layers:
  network (e.g. sicslowpan / rime), Medium Access Control MAC
  (e.g. CSMA), Radio Duty Cycling RDC (e.g. ContikiMAC, X-MAC), and
  radio (e.g. cc2420).
* Introduces a new way to configure the network stack. Four #defines
  that specify what mechanism/protocol/driver to use at the four
  layers: NETSTACK_CONF_NETWORK, NETSTACK_CONF_MAC, NETSTACK_CONF_RDC,
  NETSTACK_CONF_RADIO.
* Adds a callback mechanism to inform the MAC and network layers about
  the fate of a transmitted packet: if the packet was not possible to
  transmit, the cause of the failure is reported, and if the packets
  was successfully transmitted, the number of tries before it was
  finally transmitted is reported.
* NULL-protocols at both the MAC and RDC layers: nullmac and nullrdc,
  which can be used when MAC and RDC functionality is not needed.
* Extends the radio API with three new functions that enable more
  efficient radio duty cycling protocols: channel check, pending
  packet, and receiving packet.
* New initialization mechanism, which takes advantage of the NETSTACK
  #defines.
2010-02-18 21:48:39 +00:00
adamdunkels d68af249ec Added a MAC layer return value that informs the caller that a packet did not receive a MAC layer acknowledgement 2010-02-03 01:17:32 +00:00
adamdunkels 181213124b Added a configuration option for setting the MAC channel check rate (which must be a power of two). The configuration is independent of the MAC protocol. 2010-02-02 23:28:58 +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 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 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
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
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
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 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
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
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
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 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 91d280c4c9 Reverted to the old behaviour on broadcasts: send strobes for both unicast and broadcast packets. 2009-02-07 18:45:50 +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 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 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 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 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 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
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
oliverschmidt 7904a7e294 Made it compile again. 2007-05-22 22:10:30 +00:00