Commit Graph

220 Commits

Author SHA1 Message Date
Fredrik Osterlind
3bf99ca040 LEDS_ALL configurable 2011-02-09 15:29:41 +01:00
adamdunkels
cea299d79a Call upper layers even if packet reception failed - this allows the RDC layer to shut off the radio even if a malformed packet was received. 2011-01-09 21:09:28 +00:00
dak664
8b5577eca2 Patch from Roger Larsson to answer mac address request, for testing autoconfigure. 2010-12-23 22:38:47 +00:00
adamdunkels
d267b5ca94 Re-added timestamp support for outbound packets that was removed when switching to the new radio API 2010-12-16 22:40:52 +00:00
adamdunkels
417c7f8c70 Added parenthesis around addresses to allow expressions as arguments 2010-12-16 22:39:50 +00:00
adamdunkels
433d42e170 Bugfix: if the cc2420_cca() function wasn't able to turn on the radio properly, it should turn it off again if it was off before. 2010-12-05 00:14:24 +00:00
adamdunkels
5585d72c86 A simple but substantial change: uIP used the htons()/HTONS() macro
functions for converting between host and network byte order. These
names are the de facto standard names for this functionality because
of the original BSD TCP/IP implementation. But they cause problems for
uIP/Contiki: some platforms define these names themselves (Mac OS,
most notably), causing compilation problems for Contiki on those
platforms.

This commit changes all htons to uip_htons instead. Same goes for
htonl, ntohs, and ntohl. All-caps versions as well.
2010-10-19 18:29:03 +00:00
nifi
e242fb28bf Reverted radio API change in CC2420 (not yet fully integrated with Contiki core) 2010-09-23 08:26:06 +00:00
adamdunkels
40ee35e8c8 Rewrote all busy waits with a new macro, which has a built-in timeout to ensure that busy waits won't hang the CPU 2010-09-22 22:01:53 +00:00
nifi
d06a1ecc0c corrected include path 2010-08-25 18:35:52 +00:00
nifi
3e6113be72 removed debug output 2010-06-30 09:03:20 +00:00
nifi
c44cf73e4f Adapted to new SPI and CC2420 naming 2010-06-24 11:25:55 +00:00
nifi
f609cb0f7c Added macro to read from CC2420 RAM 2010-06-24 11:25:07 +00:00
nifi
49a2ca6b1e Fixed naming of CC2420 macros 2010-06-24 09:28:38 +00:00
nifi
fb3c2e75cf removed obsolete definitions 2010-06-24 09:28:12 +00:00
nifi
c6b6b6625c removed obsolete header file for CC2420 2010-06-24 09:20:28 +00:00
joxe
f7a82a9145 split SPI code into generic and CC2420-related and renamed constants in CC2420 2010-06-23 10:15:28 +00:00
joxe
bc398ca546 removed platform dependent loop-count from cc2420 - moved to platform config instead 2010-06-21 19:48:00 +00:00
joxe
a5d7b197eb added support for the Z1 platform and its 8Mhz 2010-06-21 19:09:35 +00:00
adamdunkels
3fa8ffda1a Moved the modules packetbuf, queuebuf, and packetqueue from net/rime to net/, since they are not Rime-specific 2010-06-14 19:19:16 +00:00
nifi
14b1bb9f57 Fixed to only use leds when DEBUG is set 2010-04-20 11:41:16 +00:00
adamdunkels
3670fac618 Bugfix: timing fixed 2010-04-08 18:23:24 +00:00
adamdunkels
be117afe04 After a lot of tweaking and twiddling with the timing of the ContikiMAC code and the mechanisms in the CC2420 driver, things seem to work somewhat stable now - knock on wood! 2010-04-04 07:49:30 +00:00
adamdunkels
a637ddaf4e Flush the rxfifo when turning off the radio instead of when turning it on. This seems to fix a bug that was seen in mspsim and seemed to appear on real hardware too. 2010-04-03 16:01:00 +00:00
adamdunkels
c9ca5d61e2 Rewrote the pending_packet() function to check the FIFOP pin instead of the 'pending' variable - works must better on real hardware and is now supported by the latest mspsim 2010-03-31 19:08:56 +00:00
adamdunkels
4d5f112960 New return value for invidating a link-layer collision 2010-03-30 23:00:22 +00:00
adamdunkels
5e7f99a2c0 Reverted the removal of the code that checked the FIFOP pin before reading a packet - checking FIFOP is the correct way to do it. Also added TXONCCA for now, including new radio.h return values to indicate a link-layer collision. 2010-03-30 23:00:05 +00:00
adamdunkels
a3a8c0e179 Safety check: only try to read a packet if it was preceeded by an interrupt (which sets the pending flag) 2010-03-19 13:18:53 +00:00
nifi
ea090a60e6 Fixed to call the SLIP callback function also when using IPv6 2010-03-17 07:10:25 +00:00
adamdunkels
67b0170a43 Bugfix: don't care about FIFOP when reading a packet; if the radio rx had been turned off before a packet was read, FIFOP would be zero and the packet would be trashed 2010-03-16 18:10:09 +00:00
nifi
55e0fec37e * Changed to write keys to CC2420 RAM big-endian order
* Fixed cc2420_aes_cipher() to wait for encryption to finish before reading result
2010-03-15 23:04:54 +00:00
nifi
e834562455 * Fixed FASTSPI_READ_RAM_LE to wait for tx end before reading
* Added FASTSPI_WRITE_RAM_BE to write to RAM (big-endian order)
2010-03-15 23:01:37 +00:00
adamdunkels
0035a70537 Reworked the locking code, which seems to fix a few bugs caused by the interaction with contikimac. Contikimac performs a CCA check in a preempting rtimer, which requires underlying code to properly call the GET_LOCK() macro. This fix seems to solve most problems, but there may be others left. 2010-03-14 22:45:20 +00:00
nifi
58c55340ed fixed to work with IPv6 2010-03-10 22:30:39 +00:00
joxe
1214b1fa40 made cc2420 panid and short address not dependent on endianness 2010-03-09 15:45:29 +00:00
adamdunkels
cc7d3ae142 Reset CCA mode to default. Make sure that the radio gto switched on when reading RSSI; otherwise node will reboot because of watchdog 2010-03-09 13:18:16 +00:00
adamdunkels
b9827d2b36 Bugfix: didn't correctly reset the pending flag when a packet was read from the radio 2010-02-25 16:06:44 +00:00
adamdunkels
4b04fdd328 Minor style fix 2010-02-23 18:26:26 +00:00
adamdunkels
1ee32c3074 Removed non-functional time synchronization code; added some experimental code for CCA checks (enabled CCA mode 1, a temporary development function for setting the CCA threshold); enable the possibility to switch off radio even if a packet is currently arriving 2010-02-23 18:24:49 +00:00
adamdunkels
5292005962 A null radio driver that does not do anything - useful in the native port and as a template for new radio drivers 2010-02-23 18:18:53 +00:00
adamdunkels
0b2b7bcdba Removed inadvertedly left-over include file 2010-02-18 23:52:34 +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
e455ef3533 Added the battery indicator to the sensors API 2010-01-15 08:51:21 +00:00
adamdunkels
fab672c7ba Reverted the FIFOP->FIFO change; it didn't work :( 2010-01-14 23:32:05 +00:00
adamdunkels
53edff7655 Added sensor API for the SHT11 driver 2010-01-14 20:16:33 +00:00
zhitao
93c748cc74 Bug fix for mysterious packet loss : check FIFO pin instead of FIFOP pin for any unread RX FIFO data;
Added protection of packet timestamp across interrupts. Note that race condition can still occur as interrupts and self-scheduled reads of the RX FIFO interleave in certain unusual patterns. More investigation is needed.
2009-12-11 18:32:54 +00:00
adamdunkels
6815e2a53f Code style fix 2009-12-05 11:26:20 +00:00
fros4943
9cc57c4324 generic radio return values
+ minor bug fix: SFD may go high without transmission starting (very seldom)
2009-11-13 10:07:53 +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
fros4943
5f71e9914e configurable line buffer size + simplified interrupt handler + overflow check on line buffer 2009-11-02 12:47:06 +00:00
fros4943
6f4a537aa0 serial line ringbuf implementation + increased default buffer size to 128 bytes 2009-10-27 16:20:31 +00:00
adamdunkels
8745235a79 Minor codestyle fix 2009-09-09 21:07:42 +00:00
nifi
d4b619bcc5 Renamed SPI_WAITFOREOTxBUF to SPI_WAITFORTxREADY for clarity and generalized SPI transmission status checks to work with both AVR and MSP430 2009-09-07 11:31:26 +00:00
nifi
3a8ee769cb Changed to monitor the UART transmitter buffer ready flag instead of the UART transmitter empty flag. This almost doubles the speed of transmitting data to CC2420. Patch by James Brown. 2009-08-31 12:06:34 +00:00
nifi
c81dbb6c89 Fixed problem with the radio driver changing transmission power to max when not specified at transmission. Also fixed bug where the lock was released when setting the transmission power.
Thanks to Djamel Djenouri and Marcus Lundn for identifying the problem.
2009-08-19 15:05:05 +00:00
fros4943
18a98bb573 bug fix: we need to explicitly turn off the cc2420 listen mode after a packet transmission 2009-08-19 12:00:04 +00:00
joxe
0c8b200987 added autoack configuration for CC2420 and reversed long ieee address for address recognition 2009-07-28 22:24:53 +00:00
joxe
a71664e8d1 quick fix for driver to work with 4MHz 2009-06-23 13:12:37 +00:00
adamdunkels
92862ad2a5 Increased the number of iterations for ugly-hack-loop that checks if a transmission has started, to accommodate a faster CPU speed on the MSP430 2009-04-29 11:38:50 +00:00
nifi
a3777852d4 * Corrected address for setting key 1
* Added missing include
2009-04-07 09:22:58 +00:00
adamdunkels
0076bfe8a5 Changed the name of the 'serial' module to 'serial-line' to signify that the module is about lines of data from the serial port, not individual bytes, and to make sdcc happy 2009-03-17 15:56:32 +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
f634ccfb3d Set transmission power based on packet attribute 2009-03-11 20:38:53 +00:00
adamdunkels
57b9cab27e Set RSSI, correlation, and timestamp as packet attributes for incoming packets 2009-03-02 21:59:01 +00:00
nifi
dee785ae88 added configuration of checksum and timesynch 2009-02-25 21:21:06 +00:00
adamdunkels
e34e97cd6f Minor code style fixes 2009-02-24 21:30:20 +00:00
zhitao
ae271a7f2f replaced the TMOTE_SKY macros with CONTIKI_TARGET_SKY, in conformance to the latest target hint rules 2008-11-25 09:20:54 +00:00
adamdunkels
ceb2554d2f Enabled the SHT11 register readout to allow reading the low-voltage indicator bit 2008-11-10 21:10:36 +00:00
adamdunkels
a42311dc7e Only process incoming data if the process is polled. Compile checksum checks only for IPv4. 2008-11-06 08:18:29 +00:00
joxe
673d73bfa3 added energest on all parts of leds API and some cleanup 2008-09-29 11:35:28 +00:00
adamdunkels
6a460fecdd There is problem with the CC2420 driver: under high traffic load the packets often get mangled in the receive FIFO. Not sure why this happens or how to best prevent it. As a temporary workaround, I've added an additional CRC16 check to the incoming packets. This eats two bytes from each packet, but at least protects against the erroneous packets we've seen quite a few of lately. The reception code was also cleaned up, which resulted in a smaller code size. 2008-08-26 21:44:03 +00:00
adamdunkels
f58b387bd3 Code style fixes 2008-07-08 08:23:47 +00:00
adamdunkels
1f005b6299 Moved energest.{c,h} from core/lib to core/sys: power profiling is a system mechanism, not a library 2008-07-03 23:36:30 +00:00
adamdunkels
51f4ab8b2c Changed type from off_t (that potentially conflicts with existing types.h typedefs) to unsigned long 2008-07-03 23:12:10 +00:00
adamdunkels
66876625d4 Changed name of the simple-cc2420 module to cc2420: changed all function names and variable names from simple_cc2420_* to cc2420_*. 2008-07-02 09:05:40 +00:00
adamdunkels
6b187328bd Added AES cipher constants 2008-07-02 09:03:49 +00:00
nifi
1cef019e78 Fixed typo. 2008-07-02 09:02:39 +00:00
adamdunkels
1da58b8858 Functions for interfacing the built-in AES functions of the CC2420 chip 2008-07-02 08:46:13 +00:00
adamdunkels
1586d8f36f Changed filename of the CC2420 driver from simple-cc2420 to cc2420. 2008-07-01 21:02:51 +00:00
adamdunkels
c802151453 Removed unused files 2008-07-01 20:13:24 +00:00
adamdunkels
6709823d4a Bugfix: energy estimation was not correct if a packet was sent when the radio was not in listen mode 2008-05-14 19:44:30 +00:00
adamdunkels
39abed8672 Moved old CC2420 driver to the backyard 2008-02-24 22:29:08 +00:00
adamdunkels
af48b648ee Added a function that gets called when we see SLIP input. This function can be used to determine if a node is a SLIP gateway or not. 2008-02-24 21:00:53 +00:00
adamdunkels
b001c14bf2 Code style fix 2008-02-03 20:43:35 +00:00
adamdunkels
dc70ac2584 Added calibration to channel switch if currently in receive mode. Added explicit checks for transmission activity before channel switch 2008-01-24 13:09:16 +00:00
adamdunkels
2c5964ef55 Changed default transmission behaviour to be to send without checking for channel activity first (in anticipation of radio API change that adds a CCA function to the radio API). General code cleanup. Added optional timetable profiling. Added simple_cc2420_get_channel() function, changed simple_cc2420_set_chan_pan to simple_cc2420_set_pan since we now have a dedicated simple_cc2420_set_channel 2008-01-23 14:57:19 +00:00
fros4943
0c21c8893a bugfix: wait while *either* transmitting or unvalid rssi 2008-01-17 15:38:45 +00:00
nvt-se
8a38ffea87 added declaration for simple_cc2420_get_txpower. 2008-01-15 08:53:52 +00:00
nvt-se
057cd5ac05 no ENERGEST_ON_* macro needed for levels. 2008-01-15 08:52:16 +00:00
nvt-se
c3653b96ce check if ENERGEST_CONF_LEVELDEVICE_LEVELS is set.
call ENERGEST_ON_LEVEL.
2008-01-15 08:33:02 +00:00
thiemovoigt
21c690ecae energy measurement support for TX power levels 2008-01-14 16:19:25 +00:00
adamdunkels
02ee418313 Moving timesynch.[ch] from sys/ to core/net/rime as they have more to do with Rime than with the kernel 2008-01-14 14:22:16 +00:00
adamdunkels
b356ebe009 Increased the default input line length from 40 to 80 2008-01-08 07:49:51 +00:00
adamdunkels
a0a524e128 Added watchdog_reboot() prototype 2008-01-07 14:42:35 +00:00
adamdunkels
cc6c6eee62 Added prototype for _on() and _off() functions 2008-01-07 14:41:34 +00:00
adamdunkels
d8e84abaae Made estimation of departure time better by locally measuring the average time per byte and adding this to the incoming timestamp. 2008-01-07 14:08:02 +00:00
adamdunkels
c948c97b4f Fixed timestamping to support the simple implicit network time synchronization mechanism 2007-12-16 14:30:36 +00:00
adamdunkels
d8617c7879 Added API for setting 802.15.4 channel and for measuring RSSI 2007-12-05 13:21:05 +00:00
ksb
71dc988cb9 slip.c:
char is signed but uip_buf is unsigned

spi.h:
	casted unused values to void

autostart.c:
autostart.h:
        The array itself should be const but the processes pointed to
        should not.

profile-aggregates.c:
        sizeof returns unsigned long on my platform
2007-11-18 12:27:44 +00:00
adamdunkels
e1affe5e72 Changed watchdog API by adding a start function, and renaming the restart function to periodic to make it clear that this should be called periodically 2007-11-17 10:15:50 +00:00