Commit graph

1502 commits

Author SHA1 Message Date
Billy Kozak fde3202a3f cc26xx - added optional locking mode for WDT
Added a mode, configurable by the CONTIKI_WATCHDOG_CONF_LOCK_BETWEEN_USE
macro, which locks the WDT register between uses so as to prevent
any accidental modifications
2015-08-31 09:12:16 -06:00
Billy Kozak 22d8a8dd56 cc26xx - implemented watchdog_stop
Also modified watchdog_start so that if we stop and start again the
watchdog timeout will be reset (by calling watchdog_periodic).
2015-08-31 09:12:16 -06:00
Billy Kozak dfdb0a6487 cc26xx - fixed WDT reloading
According to the TRM, the WDT does not produce a reset until it
expires twice. After expiring the WDT will set the INT flag if it
is unset, and reset the MCU if INT is already set.

Before this patch, watchdog_periodic() only un-sets the INT flag. This
means that the behaviour of watchdog_periodic is underministic in that
the value of the countdown timer will be different depending on
when the function was called.

This patch fixes this behaviour by also reloading the timout value.
2015-08-31 09:10:26 -06:00
Billy Kozak 85555cf6cf Made cc26xx WDT reload configurable with macro
CONTIKI_WATCHDOG_TIMER_TOP sets the reload value of the WDT
2015-08-31 09:10:26 -06:00
Atis Elsts 854494109d Atmel 230bb: always increase the rx frame ringbuffer cursor in rf230_read().
Avoids packet reordering in cases when RF230_CONF_RX_BUFFERS > 1.
2015-08-31 09:56:56 +02:00
Antonio Lignan 37470bbc1b Merge pull request #1055 from sumanpanchal/msp430x-elfloader
Added MSP430x ELFLOADER support to load image with large memory model.
2015-08-27 21:19:27 +02:00
Adam Dunkels bfb29d2f11 Merge pull request #1116 from cetic/pr-uip-clear-buffer
Add uip_clear_buf() macro and replace all instances of uip_len = 0
2015-08-27 10:27:08 +02:00
Harald Pichler 500078ef9a update to contiki 3.0 2015-08-26 16:01:57 +02:00
Jonas Olsson 01e36532c2 Add support for the CC13xx CPU
This commit:

* Moves all cpu files from cpu/cc26xx to cpu/cc26xx-cc13xx
* Bumps the CC26xxware submodule to the latest TI release
* Adds CC13xxware as a submodule
* Adds support for sub-ghz mode / IEEE 802.15.4g
* Splits the driver into multiple files for clarity. We now have the following structure:
  * A common module that handles access to the RF core, interrupts etc
  * A module that takes care of BLE functionality
  * A netstack radio driver for IEEE mode (2.4GHz)
  * A netstack radio driver for PROP mode (sub-ghz - multiple bands)

This commit also adds tick suppression functionality, applicable to all chips of the CC26xx and CC13xx families. Instead waking up on every clock tick simply to increment our software counter, we now only wake up just in time to service the next scheduled etimer. ContikiMAC-triggered wakeups are unaffected.

Laslty, this commit also applies a number of minor changes:
* Addition of missing includes
* Removal of stub functions
* Removal of a woraround for a CC26xxware bug that has now been fixed
2015-08-23 19:54:42 +01:00
Billy Kozak feec05cdf2 CC26xx - fix misuse of len variable in read_frame
read_frame was misuing the packet length in the following ways:
- returning non-zero even if buf_len is too short for the packet
- truncating the length to buf_len if len is too long then using the
  truncated (i.e. wrong) length to index into the buffer
- memcpying too many bytes (used buf_len instead of real length)

This commit fixes all of this and adds some code to report
on packet length errors (to match with cc2538 driver).
2015-08-14 12:44:55 -06:00
Billy Kozak ceb24f656e Improved style of read_frame
- moved variable declaration to top of function in accordance with the
  Contiki style guide
- made function flatter, reduced nesting to improve readability
2015-08-14 12:43:34 -06:00
Billy Kozak 547f8e7aaa Fixed race condition with rf cpu in read_frame
Fixed a race condition that could occur in read_frame because the
dataEntry is set to PENDING before we are finished reading from it.
2015-08-14 12:42:10 -06:00
Fabien Castanier 49b24e6f53 Modified the parameter name of clock_wait function 2015-08-05 13:59:08 +02:00
Oliver Schmidt 5f6a672e23 Merge pull request #1184 from oliverschmidt/master
Adjusted retro target clock to "new" DNS resolver.
2015-08-04 15:39:18 +02:00
Oliver Schmidt ca2552461e Adjusted retro target clock to "new" DNS resolver.
The DNS resolver requires 1/4 sec clock resolution. The retro targets had a 1/2 sec clock resolution (optimized for the 1/2 sec TCP timer) resulting in DNS resolver timeouts being 0. Therefore the retro target clock resolution is now increased to 1/4 sec.
2015-08-04 13:48:08 +02:00
George Oikonomou 195ada6668 Merge pull request #1107 from phoenix-frozen/cc2530-rf-const-warning
fix minor warning in cc2530-rf driver
2015-08-03 10:28:43 +01:00
Marco Grella 62c33260bd Modified structure to use a sub-module for platform APIs 2015-07-31 17:11:27 +02:00
Marco Grella b61152bfa1 I/O libraries 2015-07-24 19:54:05 +02:00
Marco Grella 86f35536a4 Added new stm32nucleo-spirit1 platform 2015-07-24 16:30:10 +02:00
Billy Kozak 35919f6836 CC26xx - Enable RX_NOK on DEBUG builds
Enabled the RX_NOK interrupt, if DEBUG or CC26XX_DEBUG_CRC are set
true, for the purpose of monitoring packets with bad CRC
2015-07-20 10:47:06 -06:00
Billy Kozak 99d74e949f CC26xx autoflush bad crc packets
Setting bAutoFlushCrc=1 so that the radio co-processor will
automatically drop packets with bad crc.
2015-07-16 08:58:24 -06:00
Oliver Schmidt ca50a2c6df Merge pull request #1157 from oliverschmidt/master
Allow fixup to be repeated.
2015-07-09 23:31:00 +02:00
Oliver Schmidt f348f4feb2 Allow fixup to be repeated.
There are scenarios in which it is beneficial to search for an Etherne chip at several i/o locations. To do so the chip initialization is performed at several i/o locations until it succeeds. In order to allow for that operation model the i/o location fixup needs to be repeatable.

Note: This won't work with the RR-Net because the fixup bits overlap with the chip i/o bits.
2015-07-09 22:43:16 +02:00
Billy Kozak b7565f3930 turned on correlator in radio packet filter
Enabling this option seems to greatly improve transciever performance with
Contikimac. This seems to happen because Contikimac CCAs are much less likely
to detect false positives (thus screwing up the CCA sequence).
2015-07-06 16:28:40 -06:00
Antonio Lignan 8cc0a12a9f Merge pull request #1097 from bthebaudeau/cc2538-examples-fix-warnings
cc2538: examples: Fix build warnings
2015-06-24 11:39:24 +02:00
Oliver Schmidt 08be27b602 Merge pull request #1139 from oliverschmidt/master
Several minor retrocomputing configuration changes.
2015-06-22 07:59:25 +02:00
Oliver Schmidt fc9d38caba Reduced default for number of connections.
Save some memory by reducing the the default for number of connections from 10 to 2.
2015-06-21 20:58:51 +02:00
Oliver Schmidt ac3b8b0955 Merge pull request #1138 from oliverschmidt/master
Fix DHCP client retries.
2015-06-21 17:42:49 +02:00
Oliver Schmidt 8c346dd762 Removed (dysfunctional) dependency generation from cc65 .co file rule.
The default gcc .co file rule doesn't support dependency generation too.
2015-06-21 16:39:12 +02:00
Oliver Schmidt b8bece508a Fix DHCP client retries.
In order to have DHCP retries actually work dhcpc_appcall() must be called for PROCESS_EVENT_TIMER too.
2015-06-21 14:25:52 +02:00
George Oikonomou b4ec0c7c1d Remove doxygen explicit links to non-existing symbols
Parts of the stm32w108 doxygen comments have explicit links to symbols that do not exist anywhere in our source base, let alone be documented. This is likely to be caused by a partial import of manufacturer libraries in the Contiki source tree.

These links were previously not generating warnings in the doxygen log because we were not defining `DOXYGEN_SHOULD_SKIP_THIS` and they were thus being skipped altogether by the doxygen pre-processor. Defining `DOXYGEN_SHOULD_SKIP_THIS` causes those doxygen comments to get processed and to thus generate warnings.

This commit removes explicit links to non-existent symbols and updates `doxyerrors.cnt` accordingly.
2015-06-20 16:10:25 +01:00
Benoît Thébaudeau 2eef189a0a doxygen: Fix some warnings
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-20 03:22:31 +02:00
Benoît Thébaudeau 0b1a0d2bd9 Merge pull request #1092 from g-oikonomou/contrib/remote_watchdog_stop
Remove CC2530 and CC2538 dummy watchdog_stop()
2015-06-18 21:56:13 +02:00
Sumankumar Panchal db4df30366 Added MSP430X ELFLOADER support to load image with large memory model. 2015-06-15 17:53:18 +05:30
Laurent Deru 1784338b2e Add uip_clear_buf() macro and replace all instances of uip_len = 0; with it 2015-06-15 11:10:51 +02:00
Oliver Schmidt c9edb9006b Merge pull request #1112 from oliverschmidt/master
Various improvements of the HTTP client and web browser.
2015-06-14 16:12:24 +02:00
Justin King-Lacroix f968e53250 fixed minor warning in cc2530-rf driver 2015-06-10 18:20:04 +01:00
Benoît Thébaudeau afe5d0403d cc2538: Build without the Contiki target library
The GNU linker ld searches and processes libraries and object files in
the order they are specified. Library files are archive files whose
members are object files. The linker handles an archive file by scanning
through it for members that define symbols that have so far been
referenced but not defined. But an ordinary object file is linked in the
usual fashion.

The C library is implicitly linked after all object files and libraries
specified on the command line.

Because of that, if the C library depends on the Contiki target library,
e.g. for the implementation of system calls, then these dependencies are
not linked, which results in undefined references. Actually, the Contiki
target library also needs the C library, hence a circular dependency
between these libraries, which means that explicitly adding -lc anywhere
on the command line can not help. The only solution in that case is to
pass these libraries to ld between --start-group and --end-group.
Archives grouped in this way are searched repeatedly by the linker until
no new undefined references are created.

This archive grouping option has a significant performance cost for the
linking stage. Moreover, having to use it and to pass -lc explicitly on
the command line is unusual, which is disturbing and more complicated
for users needing the C library to depend on the Contiki target library.
The same would be true for circular dependencies between the Contiki
target library and any other library.

Another issue with the Contiki target library is that it may alter the
apparent behavior of the weak vs. strong symbols, because of the way ld
handles archives, which may make it discard archive object files
containing strong versions of referenced symbols:
 - If a symbol has a weak and a strong version in this library, both
   inside the same object file, then the linker uses the strong
   definition.
 - If a weak symbol in this library has a strong counterpart in an
   object file outside, then the linker uses the strong definition.
 - If a strong symbol in this library is inside an object file
   containing other referenced symbols, and has a weak counterpart
   anywhere, then the linker uses the strong definition.
 - If a strong symbol in this library is the only symbol referenced in
   its object file, and has a weak counterpart in an object file
   outside, then the linker uses the strong definition if this library
   is linked first, and the weak one otherwise.
 - If a strong symbol in this library is the only symbol referenced in
   its object file, and has a weak counterpart in another object file in
   this library, then the linker uses the definition from the first of
   these objects added when creating this archive.
 - If a symbol has a weak and a strong version, one in this library, and
   the other in another library, then the rules are the same as if both
   were in the Contiki target library.

The existence of cases where the linker uses a weak symbol despite the
presence of its strong counterpart in the sources compiled then passed
to the linker is very error-prone, all the more this behavior depends on
the order the object and archive files are passed on the command lines,
which may just result from the order of source files in lists where it
apparently does not matter. Such cases would be needed in the future,
e.g. to define weak default implementations of some system calls that
can be overridden by platform-specific implementations, both ending up
in the Contiki target library. There was already such a case used to
define the UART and USB ISRs as weak aliases of default_handler(),
relying on this implicit unusual behavior to keep default_handler() if
the UART or USB driver was unused, which was dangerous.

Since the Contiki target library was only used as an intermediate file
during the build, the current commit fixes these issues by simply
directly using the object files instead of building an intermediate
archive from them.

The CONTIKI_OBJECTFILES make variable would be incomplete if it were
used as a simple prerequisite in the %.elf rule in Makefile.cc2538,
because other object files are added to it after this rule. That's why
.SECONDEXPANSION is used to defer its expansion. Another solution would
have been to split Makefile.cc2538, with the variable assignments kept
in it, and the rule definitions moved to Makefile.customrules-cc2538,
but this would have required to add Makefile.customrules-<target> files
to all CC2538 platforms, only to include Makefile.customrules-cc2538.
The solution used here is much simpler.

Because the UART and USB ISRs were weak aliases of default_handler(),
this change would imply that these ISRs would always be used by the
linker instead of default_handler(), even if their drivers were
configured as unused with UART_CONF_ENABLE and USB_SERIAL_CONF_ENABLE,
which would be wrong. This commit fixes this issue by removing these
weak aliases and putting either these ISRs or default_handler() in the
vector table, depending on the configuration. Weak aliases are elegant,
but Contiki's build system does not currently allow to automatically
build or not source files depending on the configuration, so keeping
these weak aliases would have required to add #if constructs somewhere
in the source code, which would have broken their elegance and made them
pointless.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-05 21:55:51 +02:00
Benoît Thébaudeau 0f137e4bdd cc2538: uart: Make uart_isr() static
This function is only supposed to be used by uart.c, so it should be
static.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-05 21:50:49 +02:00
Benoît Thébaudeau e8a268cd15 cc2538: aes: Add support for 192- and 256-bit keys
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-02 21:41:56 +02:00
Benoît Thébaudeau 801315e819 cc2538: aes: Make it possible to have several keys stored at once
Several keys can be kept at the same time in the key store, and several
keys can be loaded at once. Give access to these features.

The ccm-test example is also improved to better demonstrate the use of
the key store.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-02 21:41:07 +02:00
Benoît Thébaudeau b92a5afcc4 cc2538: ccm: Make it possible to use the interrupt
Using the AES interrupt allows the user process not to waste time
polling for the completion of the operation. This time can be used by
the user process to do something else, or to let the system enter PM0.

Since the system is now free to perform various operations during a
crypto operation, a protection of the crypto resource is added, and PM1+
is prohibited in order not to stall crypto operations.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-02 21:41:07 +02:00
Benoît Thébaudeau 117dc4e5e3 cc2538: Add crypto drivers and examples for AES-CCM and SHA-256
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-02 21:41:06 +02:00
Benoît Thébaudeau 66acf74612 cc2538: examples: Fix build warnings
Toolchain used:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150303
(release) [ARM/embedded-4_9-branch revision 221220]

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-06-02 01:38:11 +02:00
George Oikonomou d28eb023ef Remove CC2530 and CC2538 dummy watchdog_stop()
The CC2538 the WDT cannot be stopped once it has been started.
The CC2530/1 WDT can be stopped if it is running in timer mode,
but it cannot be stopped once it has been started in watchdog mode.

Both platforms currently provide "dummy" implementations of `watchdog_stop()`,
one does nothing and the other one basically re-maps `_stop()` to
`_periodic()`.

This was originally done in order to provide implementations for all prototypes
declared in `core/dev/watchdog.h`. In hindsight and as per the discussion
in #1088, this is bad practice since, if the build succeeds, the caller will
expect that the WDT has in fact been stopped, when in reality it has not.

Since the feature (stopping the WDT) is unsupported by the hardware, this pull
removes those dummy implementations. Thus, we will now be able to reliably
detect - at build time - attempts at using this unsupported feature.
2015-06-01 15:24:14 +01:00
Oliver Schmidt 4a6909d16a Remove RDC config from retro definitiions.
After the modularization of the Contiki libraries this isn't necessary anymore.
2015-05-25 13:43:11 +02:00
Benoît Thébaudeau 1cd3c9e7e5 cc2538: Initialize .data/.bss using ROM functions
This is safer because the previous code assumed that the start and end
VMAs of .data and .bss were word-aligned, which is not always the case,
so the initialization code could write data outside these sections. The
ROM functions support any address boundary.

This is faster because the ROM functions are ultra optimized, using
realignment and the LDM/STM instructions, which is much better than the
previous simple loops of single word accesses.

This is smaller because the ROM functions don't require to add any code
to the target device other than simple function calls.

This makes the code simpler and more maintainable because standard
functions are not reimplemented and no assembly is used.

Note that this is also faster and smaller than the corresponding
functions from the standard string library.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-05-23 18:50:52 +02:00
Benoît Thébaudeau 609c615303 cc2538: Move the stack out of .bss
The initialization code clearing .bss is allowed to use the stack, so
the stack can not be in .bss, or this code will badly fail if it uses
the stack.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-05-23 18:50:52 +02:00
Benoît Thébaudeau 0de729572b cc2538: Word-align .data LMA
In order to be fast, the reset_handler() function uses word accesses to
initialize the .data output section. However, most toolchains do not
automatically force the alignment of an output section LMA to use the
maximum alignment of all its input sections. Because of that, assuming
that .data contains some words, the LMA of the .data output section was
not word-aligned in some cases, resulting in an initialization performed
using slow unaligned word accesses.

This commit forces the alignment of the LMA of the .data output section
with a word boundary in order to always use fast aligned word accesses
to read the .data load area.

Note that this solution is better than using ALIGN_WITH_INPUT, both
because the latter is a new feature incompatible with older toolchains,
and because it could create a big gap between _etext and the LMA of
.data if strongly-aligned data were added to .data, although only a word
alignment is required here.

The same considerations apply to the VMA of .data. However, it is
already automatically word-aligned, both because .data contains words,
and because the end VMA of the previous output section (.socdata) is
word-aligned. Moreover, if the VMA of .data were forcibly word-aligned,
then a filled gap could appear at the beginning of this section if
strongly-aligned data were added to it, thus wasting flash memory.
Consequently, it's better not to change anything for the VMA of .data,
all the more it's very unlikely that it does not contain any word and
that the end VMA of .socdata becomes non-word-aligned, and this would
only result in a slower initialization.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-05-23 18:12:54 +02:00
Benoît Thébaudeau 0d260f61a0 cc2538: Fix .data LMA/VMA mismatch with some toolchains
Some toolchains, like Sourcery CodeBench Lite 2013.05-23 arm-none-eabi
(http://sourcery.mentor.com/public/gnu_toolchain/arm-none-eabi/)
automatically force the alignment of an output section LMA to use the
maximum alignment of all its input sections. This toolchain uses GNU
binutils 2.23, and this automatic behavior is the same as the manual
behavior of the ALIGN_WITH_INPUT feature of GNU binutils 2.24+.

This behavior is not an issue per se, but it creates a gap between
_etext and the LMA of the .data output section if _etext does not have
the same alignment, while reset_handler() initialized this section by
copying the data from _etext to its VMA, hence an offset in the
addresses of loaded data, and missing data.

This commit fixes this issue by making reset_handler() directly use the
LMA of the .data section using LOADADDR(.data), rather than assuming
that _etext is this LMA.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-05-23 18:12:53 +02:00
Harald Pichler 9b6bdd30b8 use all submodules 2015-05-21 21:31:18 +02:00
Antonio Lignan 2cee62eb33 Merge pull request #1074 from g-oikonomou/cc26xx/contrib/new-cc26xxware
Update to latest CC26xxware and add it as a submodule
2015-05-21 10:01:00 +02:00
Ulf Knoblich d8efa8428c cc2538: Allow for configuration of processor speed 2015-05-19 18:55:55 +02:00
Harald Pichler 6a0d407806 Merge branch 'contiki' into osd 2015-05-19 10:54:55 +02:00
Adam Dunkels 730bda2001 Merge pull request #883 from cmorty/pull/global-macros
Move MAX, MIN and ABS to contiki-macros
2015-05-18 21:33:00 +02:00
Ulf Knoblich a388a1bcd7 CC2538: added support for SSI1 2015-05-18 10:02:55 +02:00
Moritz 'Morty' Strübe 0dab6926b3 Move MAX, MIN and ABS to sys/cc.h 2015-05-18 08:53:17 +02:00
George Oikonomou 5d20e76346 Adjust the build system to use CC26xxware as a sub-module 2015-05-17 15:01:01 +01:00
George Oikonomou 40e82395c4 Pull CC26xxware as a submodule 2015-05-17 15:01:01 +01:00
George Oikonomou b4067560ba Remove references to obsolete peripheral clock scaling functions 2015-05-17 15:01:01 +01:00
George Oikonomou ab4249a709 Adjust retention calls
* Rename VIMS-related calls
* Remove obsolete ones
2015-05-17 15:01:01 +01:00
George Oikonomou b38d32b281 Rename AON WUC power status macros 2015-05-17 15:01:01 +01:00
George Oikonomou 8673bbdd55 Update linker script to accommodate for larger CCFG size 2015-05-17 15:01:00 +01:00
George Oikonomou 09a8c54eb1 Update CC26xxware glue macros
* Remove references to removed functions
* Add macros to new functions
* Rename macros to renamed functions
* Add macros for the HAPI
2015-05-17 14:09:52 +01:00
George Oikonomou 5f4154a0e3 Adjust AON BatMon usage 2015-05-17 14:09:51 +01:00
Benoît Thébaudeau 25532e8abf Merge pull request #754 from wwhuang/master
[CC2538] Fix SPI_FLUSH
2015-05-16 20:55:30 +02:00
Antonio Lignan e8b1a57ac6 Merge pull request #809 from cmorty/pull/msp430_gstabs
[MSP430] Add gstabs debug information (dwarf is broken)
2015-05-16 11:01:47 +02:00
Antonio Lignan 32afadea77 Merge pull request #1047 from g-oikonomou/cc26xx/contrib/lpm
CC26xx Ultra Low Power Operation
2015-05-16 10:27:22 +02:00
George Oikonomou 1cf37e0c1a Tidy-up code style 2015-05-15 23:36:54 +01:00
Harald Pichler 877bf27f5a Merge branch 'contiki' into osd 2015-05-15 20:48:26 +02:00
George Oikonomou 78d04f812b Fix typo in macro 2015-05-15 09:21:05 +01:00
George Oikonomou 07272b7cd6 Improve UART power-cycling logic:
* Only enable TX by default.
* Add some magic for RX handling. When an input handler is registered:
  * Automatically enable RX-related and interrupts
  * Automatically lock the SERIAL PD on under all power modes
  * Automatically enable the UART clock under sleep and deep sleep
  * Automatically undo all of the above when the input handler becomes NULL
  * As a result, modules / examples that need UART RX no longer need to clock the UART and manipulate the SERIAL PD. They simply have to specify an input handler
* Don't automatically power on the UART whenever the CM3 is active
* Before accessing the UART, make sure it is powered and clocked
* Avoid falling edge glitches
* Fix garbage characters / Explicitly wait for UART TX to complete
2015-05-15 09:21:04 +01:00
George Oikonomou 34f52ed08e Improve the LPM module:
* Implement new style of PD locks
* Use our own shutdown sequence rather than the one provided by cc26xxware
* Shutdown from within the interrupt that requested it. This allows shutdown to take place even if the code is stuck in a loop somewhere else
* Improve DCDC/GLDO/uLDO switching logic
* Explicitly handle oscillators and retentions
2015-05-15 09:21:04 +01:00
George Oikonomou eb5b11a85a Re-order instructions in the RTC startup sequence 2015-05-15 09:21:03 +01:00
George Oikonomou 421fbfae25 Change the LPM locks API:
Instead of using a separate data structure to request that a PD remain powered during deep sleep,
we do the same within the main LPM data structure through an additional field.

This allows us to maintain only one linked list of LPM modules and overall improves code clarity
2015-05-15 09:21:02 +01:00
George Oikonomou b3ac3ac0c1 Add function to unregister a module from LPM 2015-05-15 09:21:02 +01:00
George Oikonomou cf99160706 Change lpm_shutdown() API call:
So that the caller can specify pin pull and wakeup state
2015-05-15 09:21:01 +01:00
George Oikonomou 5644e95fb6 Fix global interrupt manipulation 2015-05-15 09:21:00 +01:00
George Oikonomou bd79e18e1e Switch between oscillator's using the dedicated module's functions 2015-05-15 09:21:00 +01:00
George Oikonomou ad52d68a0c Add function to configure a pin to a default state 2015-05-15 09:21:00 +01:00
George Oikonomou 3877190196 Change function to static 2015-05-15 09:21:00 +01:00
George Oikonomou 3bbf3cc435 Add SysCtrl glue macros 2015-05-15 09:20:57 +01:00
George Oikonomou 8a42af682d Make sure PERIPH is on before accessing GPT registers 2015-05-15 09:20:57 +01:00
George Oikonomou 9d97dee00b Clock the GPT module only when we need it 2015-05-15 09:20:57 +01:00
George Oikonomou b7e7d48f0b Add oscillator control wrappers 2015-05-15 09:20:56 +01:00
Brad Campbell 3b6d9e5a64 mc1322x: remove rest tutorial
This tutorial was written for the older implementation of CoAP, and
while it may be possible to update it, the directions include URLs and
repos that no longer exist, so it's better to just remove it.
2015-05-14 17:20:46 -04:00
Benoît Thébaudeau c9324d133f Merge pull request #1060 from g-oikonomou/cc26xx/contrib/ihex
Produce ihex files usable with TI's Flash Programmer
2015-05-14 19:24:36 +02:00
Benoît Thébaudeau d64927397f Merge pull request #968 from g-oikonomou/cc2538-contrib-on-chip-sensors
Move CC2538 VDD/3 and On-Chip Temp sensors to the CPU dir
2015-05-14 19:21:56 +02:00
Benoît Thébaudeau 71f22b1775 Merge pull request #966 from g-oikonomou/cc2538-startup-to-cpu-dir
Move cc2538 startup-gcc.c to the CPU dir
2015-05-14 18:43:39 +02:00
George Oikonomou 69c4f19336 Produce ihex files usable with TI's Flash Programmer 2015-05-14 13:22:11 +01:00
George Oikonomou f7baf5aba2 Change CC2538 USB and UART handlers to weak 2015-05-13 01:31:26 +01:00
George Oikonomou 96e1647270 Move cc2538 startup-gcc.c to the CPU dir 2015-05-13 01:31:10 +01:00
George Oikonomou 3717522680 Re-work the CC2538 driver to be a driver for the Srf06 ALS only 2015-05-12 23:42:19 +01:00
George Oikonomou 06b0ee4a8b Include CC2538 sensors in the build 2015-05-12 23:42:19 +01:00
George Oikonomou 9cc800d728 Add CC2538 VDD sensor driver 2015-05-12 23:42:19 +01:00
George Oikonomou f474514ee5 Add CC2538 tmp sensor driver 2015-05-12 23:42:19 +01:00
George Oikonomou 40716ab515 Add generic header for CC2538 sensors 2015-05-12 23:42:18 +01:00
George Oikonomou cf1f722a93 Merge pull request #1045 from g-oikonomou/cc26xx/contrib/cc26xx-rf-wakeup
Fix "CC26xx delayed wakeup after RF TX" bug
2015-05-09 22:50:50 +01:00
George Oikonomou bd5e35c968 Merge pull request #1052 from simonduq/packetbuf-cleanup
Packetbuf cleanup
2015-05-09 22:30:21 +01:00
George Oikonomou 33526be5ab Merge pull request #985 from g-oikonomou/cc26xx-minor-updates
Minor Updates to the CC26xx Port
2015-05-09 22:29:30 +01:00
George Oikonomou a2d6df225e Merge pull request #967 from g-oikonomou/cc2538-contrib-rf-local-vars
Use local variable to store RF on/off state
2015-05-09 22:23:31 +01:00
George Oikonomou 94299af9f7 Merge pull request #983 from g-oikonomou/cc26xx-watchdog
Fix typo in CC26xx WDT-related macros
2015-05-09 22:04:06 +01:00
Simon Duquennoy 290fc829ea Consistently use PACKETBUF_ATTR_MAC_SEQNO for MAC sequence number, both input and output. Disable PACKETBUF_ATTR_PACKET_ID in the non-Rime case. 2015-05-06 16:34:44 +02:00
Simon Duquennoy bb76bb8beb Remove unused flag SICSLOWPAN_CONF_ACK_ALL. Include packetbuf attribute PACKETBUF_ATTR_RELIABLE only when RIME is compiled. 2015-05-06 16:34:26 +02:00
George Oikonomou c77cf4bb90 Fix BLE on/off check 2015-05-03 22:36:03 +01:00
George Oikonomou f83c4e7286 Improve code style 2015-05-03 22:36:03 +01:00
George Oikonomou 2059be3a43 Merge pull request #1031 from bthebaudeau/cc2538-gpio-irqs
cc2538: gpio: Improve and fix IRQ management
2015-05-03 18:42:53 +01:00
George Oikonomou 0c827a9739 Fix typo in CC26xx WDT-related macros 2015-05-01 17:13:38 +01:00
George Oikonomou 5cbde8b19b Fix CC26xx RF delayed wakeup after TX bug 2015-05-01 15:26:57 +01:00
Ulf Knoblich 8e624c750d cc2538 i2c bug in clock computation 2015-04-29 11:07:59 +02:00
Benoît Thébaudeau 3d9d52de87 cc2538: gpio: Fix missed interrupts
Only the interrupt flags that have been handled must be cleared.
Otherwise, if a new interrupt occurs after the interrupt statuses are
read and before they are cleared, then it is discarded without having
been handled. This issue was particularly likely with two interrupt
trigger conditions occurring on different pins of the same port in a
short period of time.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-04-27 01:14:51 +02:00
Benoît Thébaudeau 1a5632cba0 cc2538: gpio: Fix missed power-up interrupts
Power-up interrupts do not always update the regular interrupt status.
Because of that, in order not to miss power-up interrupts, the ISR must
handle both the regular and the power-up interrupt statuses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-04-27 01:14:51 +02:00
Benoît Thébaudeau 1e67ab3941 cc2538: gpio: Add macros to get interrupt status
Introduce new useful GPIO macros to:
 - get the raw interrupt status of a port,
 - get the masked interrupt status of a port,
 - get the power-up interrupt status of a port.

These macros are cleaner and less error-prone than raw register access
code copied all over the place.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-04-27 01:14:51 +02:00
Benoît Thébaudeau 41d9078ed4 cc2538: gpio: Factor out duplicated ISR code
This makes the code easier to maintain, and this reduces the binary
image size.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-04-27 01:14:50 +02:00
Oliver Schmidt a824722862 Merge remote-tracking branch 'upstream/master' 2015-04-26 14:35:40 +02:00
Oliver Schmidt 7b3e80a957 Remove received packet(s) to allow to send one.
Behave just like the CS8900A driver: Both the CS8900A and the LAN91C96 dynamically share a buffer for received packets and packets to be send. If the chip is exposed to a network with a lot of broadcasts the shared buffer might fill quicker with received packets than the 6502 reads them (via polling). So we might need to drop some received packets in order to be able to send anything at all.
2015-04-26 14:23:33 +02:00
George Oikonomou 692d50d22f Don't reject frames with version==1 2015-04-14 12:58:49 +01:00
Nicolas Tsiftes 8f50d9709d Merge pull request #999 from adamdunkels/lebrush-rdnss-support-rebased
RDNSS support, again
2015-03-30 17:21:23 +02:00
George Oikonomou 489f9618e8 Update #if guard to match header filename
Closes #952
2015-03-28 23:53:05 +00:00
George Oikonomou 48e987baac Merge pull request #1005 from alignan/i2c_cc2538
CC2538 I2C driver
2015-03-28 23:23:06 +00:00
Benoît Thébaudeau 19fd7a3551 Use additive offsets
OR-ing an offset to a base address instead of adding it is dangerous
because it can only work if the base address is aligned enough for the
offset.

Moreover, if the base address or the offset has a value unknown at
compile time, then the assembly instructions dedicated to 'base +
offset' addressing on most CPUs can't be emitted by the compiler because
this would require the alignment of the base address against the offset
to be known in order to optimize 'base | offset' into 'base + offset'.
In that case, the compiler has to emit more instructions in order to
compute 'base | offset' on most CPUs, e.g. on ARM, which means larger
binary size and slower execution.

Hence, replace all occurrences of 'base | offset' with 'base + offset'.
This must become a coding rule.

Here are the results for the cc2538-demo example:
 - Compilation of uart_init():
    * before:
        REG(regs->base | UART_CC) = 0;
        200b78:	f446 637c 	orr.w	r3, r6, #4032	; 0xfc0
        200b7c:	f043 0308 	orr.w	r3, r3, #8
        200b80:	2200      	movs	r2, #0
        200b82:	601a      	str	r2, [r3, #0]

    * now:
        REG(regs->base + UART_CC) = 0;
        200b7a:	2300      	movs	r3, #0
        200b7c:	f8c4 3fc8 	str.w	r3, [r4, #4040]	; 0xfc8

 - Size of the .text section:
    * before:	0x4c7c
    * now:	0x4c28
    * saved:	84 bytes

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-03-28 17:28:15 +01:00
William Huang 1e39c9a454 fixed SPI_FLUSH. current implementation waits for rx buffer to fill first. Thus, if we call SPI_FLUSH to make sure the rx fifo is empty when the rx fifo is already empty, we enter an infinite loop 2015-03-26 14:17:06 -04:00
Antonio Lignan 22be9fd8b7 I2C driver taken from PR #677, uncrustified, made functions static and added burst modes 2015-03-25 16:44:12 +01:00
Harald Pichler 560117e8f3 Merge branch 'contiki' into osd 2015-03-23 13:07:28 +01:00
George Oikonomou c169b3e3bb Merge pull request #845 from alignan/fix_region
Changed code region to any
2015-03-10 22:04:38 +00:00
Jonas Olsson 5e5e9b92fd Add CC26xx CPU files 2015-02-25 13:09:56 +01:00
Harald Pichler d31ecbf486 Merge branch 'contiki' into osd 2015-02-18 10:04:47 +01:00
George Oikonomou 5288725af7 Use local variable to store RF on/off state
Fixes #823
2015-02-18 09:05:02 +01:00
Nicolas Tsiftes 080de75c87 Merge pull request #959 from g-oikonomou/cc2538-doc
Improve CC2538 documentation
2015-02-17 08:50:18 +01:00
Jim Paris d350aa4dd7 Fix aducrf101 builds with GCC 4.9+
Mixing LTO and libraries requires the use of gcc-ar instead of ar.
See https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ?action=recall&rev=5#ar.2C_nm_and_ranlib
2015-02-16 14:52:05 -05:00
George Oikonomou 6bd8bb05f6 Improve wording 2015-02-16 10:17:58 +01:00
George Oikonomou 72914369e8 Re-structure CC2538 doxygen module hierarchy 2015-02-16 10:17:58 +01:00
George Oikonomou 8751e55c94 Improve wording, fix warnigs in the SSI/SPI docs 2015-02-16 10:17:58 +01:00
George Oikonomou a93a8912c2 Clarify GPIO read and write macros 2015-02-16 10:17:57 +01:00
George Oikonomou 4100cbc9c0 Fix doxygen warning in the CC2538 uDMA driver's header 2015-02-16 10:17:57 +01:00
George Oikonomou 88e190103c Fix doxygen warning in the CC2538 SPI driver 2015-02-16 10:17:57 +01:00
George Oikonomou b6bd556805 Fix clock.h warnings caused by multiple, conflicting documentation blocks of clock functions 2015-02-15 21:48:30 +01:00
George Oikonomou a4e7cc29e8 Merge pull request #946 from e120guru/hotfix-radio-driver-error-reinit
CC2538 RF driver issues x3
2015-02-13 14:19:49 +01:00
Michael Karlsson 62fc6f2f07 corrected code style error 2015-02-13 13:46:57 +01:00
George Oikonomou 2f5db64b2b Merge pull request #947 from zwpaper/enableFlowControl
Fix the uart0 flow control register P0SEL setting in cpu cc253x
2015-02-12 08:49:33 +01:00
Harald Pichler 98be2c25ea remove for test purose 2015-01-29 11:01:27 +01:00
PapEr cd4322cec2 Fix the uart0 flow control register P0SEL setting in cpu cc253x 2015-01-25 13:57:40 +08:00
Michael Karlsson be9879cf18 fixed error in saving status 2015-01-21 22:35:30 +01:00
Michael Karlsson 37def294ce fixed bug that made radio die after error when not using default channel and/or not using a RDC protocol 2015-01-21 22:28:31 +01:00
Víctor Ariño ccc0d27da0 Integrates uip-nameserver API
On the same commit the src have been uncrustified and some typo
fixes as well as includes missing.
2015-01-09 09:44:06 +01:00
Harald Pichler 9efc5d41c1 Merge branch 'contiki' into osd 2014-12-29 08:20:00 +01:00
Nicolas Tsiftes 1f13be10fc Merge pull request #908 from bbc2/fix-rndis-macro
usb/rndis: Add parentheses to an unsafe macro
2014-12-19 22:16:33 +01:00
Jelmer Tiete b088326b5e Corrected the register offset value of ANA_REGS_IVCTRL. TI was using the address offset instead of the physical address in their header file. 2014-12-19 04:14:34 -05:00
Bertrand Bonnefoy-Claudet 9baa378c97 usb/rndis: Add parentheses to an unsafe macro 2014-12-12 19:17:46 +01:00
Luis Alves 1bddbae297 rf230bb: Fix missing ')' and indentation. 2014-12-09 22:06:12 +00:00
Harald Pichler a02be51f08 Merge branch 'contiki' into osd 2014-12-07 15:24:00 +01:00
Nicolas Tsiftes 9e7927e415 Merge pull request #765 from ejoerns/pull-req/avr-asflags
[avr] Add mcu parameter to ASFLAGS
2014-12-02 19:16:14 +01:00
Simon Duquennoy a9cc909794 Network layer configuration: replace UIP_CONF_* with NETSTACK_CONF_WITH_* 2014-12-01 21:02:57 +01:00
Simon Duquennoy 722b3258d1 Cleanup of the Contiki network layer configuration. Now using CONTIKI_WITH_IPV6, CONTIKI_WITH_IPV4, and CONTIKI_WITH_RIME in makefiles, and UIP_CONF_IPV6, UIP_CONF_IPV4, UIP_CONF_RIME in c code. Now only the stacks that are used are compiled (via makefile MODULES). Make IPv6 the default network stack. 2014-12-01 20:13:09 +01:00
Nicolas Tsiftes 9b90c378e8 Merge pull request #812 from kkrentz/packetbuf-holds-broadcast
packetbuf_holds_broadcast()
2014-11-28 19:15:19 +01:00
Josef Lusticky c6bea7d0e7 avr: fix divide when CLOCK_SECOND is not a power of two 2014-11-26 22:47:50 +01:00
Ralf Schlatterbeck f0ad042bfc Minor optimisations of timer init 2014-11-19 13:53:21 +01:00
Ralf Schlatterbeck fd54bc9ca4 Inline timer init functions, no static storage
Hardware init function profit a great deal from being inlined if the
given parameters are constant -- which is the common use-case, we could
probably call this for all timers and still have less overhead. The
hwtimer_pwm_ini (which calls hwtimer_ini) gets completely computed at
compile-time resulting only in the register settings of hwtimer_ini.

This is now possible because we get rid of static storage for the
max_ticks and instead compute this in hwtimer_pwm_max_ticks from the
timer register settings.
2014-11-19 13:52:42 +01:00
Ralf Schlatterbeck 08abd8807d Fixes for platform timer code
Some platforms are missing timer channels, this is now left to the
(missing) preprocessor definitions on those platforms, no
platform-specific defines needed anymore.
Also fix usage of timer counter register 3 (hardcoded) in
cpu/avr/dev/clock.c -- this code isn't used on many platforms as it
requires a very special quartz clock frequency but this now also uses
the platform timer specification.
2014-11-19 13:48:42 +01:00
Ralf Schlatterbeck b6be226e69 Add Arduino compatibility layer
We can now directly compile arduino sketches (.pde) files.
Arduino compatible analogWrite works now.
But there is still a long way to go, serial I/O and timer stuff (delay,
millis etc) currently don't work (not tested but I don't expect this to
work).
It can be used in an arduino sketch or in a normal contiki program.
We get a PWM frequency of 490.2 Hz (a period of 2.040 ms), that's
Arduino compatible. If you need different frequencies see native timer
usage in examples/osd/pwm-example
In a contiki program you have to call arduino_pwm_timer_init to
initialize the timer before pwm works. The arduino sketch wrapper
already does this.
For running a sketch, see examples/osd/arduino-sketch
2014-11-19 13:48:05 +01:00
Ralf Schlatterbeck b17934c491 Allow compilation of c++ files (extension .cpp) 2014-11-19 13:47:51 +01:00
Ralf Schlatterbeck cfec3c6e2d Initial implementation of avr hardware timer
Mainly for PWM use for now.
With example to set the LED to different brightness via COAP.
We switch the LED with 50 kHz (20µs) in this example.
2014-11-19 13:47:37 +01:00
Ralf Schlatterbeck 4ceffb090d Make HW timer for contiki rtimer configurable
... and configure osd platform to use timer 5. With the new
configuration we can use timer 3 for generating hardware PWM.
2014-11-19 13:44:55 +01:00
Harald Pichler 34d64b4eb0 bugfix blockmode, 8 Hz dutycyle as standard 2014-11-19 13:34:07 +01:00
kkrentz fb00a217f5 packetbuf: Use packetbuf_holds_broadcast() all-over 2014-11-13 09:58:08 -08:00
Fredrik Österlind 03a923b6b9 Merge pull request #782 from ejoerns/pull-req/avr-mcucsrfix
[avr] Removed usage of deprecated MCUSR
2014-11-13 10:25:30 +01:00
Enrico Joerns cfbd4d49bf [cpu/stm32w108] Doxygen grouping and group name fixes 2014-11-10 23:53:33 +01:00
Enrico Joerns 198f52d2f8 [cpu/pic32] Removed excess end group 2014-11-10 23:53:33 +01:00
Enrico Joerns f7711d1659 [cpu/arm] Added doxygen .txt files for gaining a minimum of documentation structure 2014-11-10 23:53:33 +01:00
Enrico Joerns e2f09a367f [cpu/arm] removed free-standing @addtogroup command 2014-11-10 23:53:33 +01:00
Enrico Joerns 7d9c80aa76 [cpu] removed faulty group names 2014-11-10 23:53:33 +01:00
Enrico Joerns 9dd7f1d29a [doc] added faulty esb and msp430 references 2014-11-10 23:53:32 +01:00
Enrico Joerns 0b8769e576 [doc] Various fixes for doxygen grouping etc. 2014-11-10 23:53:32 +01:00
Antonio Lignan 4cc070944f Changed code region to any 2014-11-03 22:40:51 +01:00
Joakim Gebart f943eb9a27 rf230bb: Handle all IRQ flags in one ISR call.
Modified the if/elseif/elseif/.../else block in ISR into multiple if
blocks in order to handle multiple interrupts happening simultaneously.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
2014-10-28 14:53:40 +01:00
Moritz 'Morty' Strübe e9ac379730 [MSP430] Add gstabs debug information (dwarf is broken)
Currently there is an linker error when compiling with debug information.
This is only the case for dwarf (the default). Everything is fine with
stabs, thus allowing to debug and use all the other nice tools like
"objdump -S".
2014-10-16 15:24:25 +02:00
Adam Dunkels d891d11324 Merge pull request #557 from kkrentz/llsec-integration
Integration of Link Layer Security
2014-10-08 15:45:46 +02:00
Enrico Joerns 8cc0bb8a1e [avr] Removed usage of deprecated MCUSR
Since avr-libc 1.8.0 MCUSR is marked as poison as it was replaced by the
correct name MCUCSR.
Thus code still using the old MCUSR name does not compile anymore.

This commit replaces usages of former MCUSR by its new name MCUCSR and
modifies the alias fallback accordingly.
2014-08-30 01:58:18 +02:00
Atis Elsts 5acf3fb770 Fix time accounting on msp430 Series 5 MCU based platforms (wismote)
See https://github.com/contiki-os/contiki/pull/727 for explanation
2014-08-21 18:09:54 +02:00
Fredrik Österlind 573d75f13d Merge pull request #727 from atiselsts/msp430_timing_fixes
Fix time accounting on msp430 Series 1 and Series 2 MCU based platforms.
2014-08-13 13:47:36 +02:00
kkrentz 4493783ce9 'free_packet' in csma.c conflicted with 'free_packet' in maca.c 2014-08-04 01:09:57 -07:00
Jim Paris 4aa2a8b95c aducrf101: Add stack pointer sampling, to help debug overflows 2014-07-29 18:25:55 -04:00
Jim Paris 3e193cca2c aducrf101: Rearrange stack and heap to maximize available stack space
Stack now starts at the top of RAM, heap starts after BSS, and
they grow towards each other.
2014-07-29 18:09:16 -04:00
Nicolas Tsiftes 582bfcb8c6 Merge pull request #696 from sieben/doc
Correct several doxygen tags (\file,...)
2014-07-28 11:42:41 +02:00
Rémy Léone 8c3fa17ec0 Correct several doxygen tags (\file) 2014-07-28 11:11:45 +02:00
Jim Paris 6db05caed9 Fix radio hangups when trying to transmit with radio off.
The border-router tries to transmit and do other stuff after turning
the radio off, and the radio driver didn't handle that very well.
With this fix, it's no longer necessary to reset the border router
after starting tunslip6.
2014-07-23 16:21:53 -04:00
Jim Paris 07201d13a3 Add IAR compiler support for ADuCRF101 2014-07-23 16:21:53 -04:00
Jim Paris a4a3eca41d Add sniffer support to ADuCRF101
This works with the examples/cc2538dk/sniffer/ project and the
corresponding "sensniff" host-side tool.
2014-07-22 21:18:17 -04:00
Jim Paris 6967fc67c1 Add dummy uart0/uart1 headers that some examples require 2014-07-22 21:18:16 -04:00
Jim Paris ad141b00fb Implement rtimers for ADuCRF101 2014-07-22 21:18:16 -04:00
Jim Paris 4cb97a3311 Move RF RX into its own process 2014-07-22 21:18:16 -04:00
Jim Paris fff8a18b99 Fix ADI radio engine driver and add hook for packet reception 2014-07-22 21:18:16 -04:00
Jim Paris b7373edf8c Add ADuCRF101 radio driver 2014-07-22 21:18:16 -04:00
Jim Paris baa6058839 Add initial ADuCRF101 CPU support 2014-07-22 21:18:16 -04:00
Jim Paris 2be02cd269 Add CMSIS library code from ARM 2014-07-22 21:12:17 -04:00
Jim Paris ee1ca8ac55 Add ADuCRF101 library code from Analog Devices 2014-07-22 21:12:17 -04:00
Oliver Schmidt 919b6919a5 Fixed hardware detection.
The previous chip detection was inspired by the old IP65 driver code. For some reason it didn't work as expected. The new code is simpler and based on this statement in the chip datasheet: "The upper byte always reads as 33h and can be used to help determine the I/O location of the LAN91C96."
2014-07-12 11:27:52 +02:00
Enrico Joerns 351e4e9fba [avr] added missing mcu parameter to ASFLAGS in order to enable assembler compilation 2014-07-10 11:31:41 +02:00
Atis Elsts 705587cdb7 Fix time accounting on msp430 Series 1 and Series 2 MCU based platforms.
The problem with the current version of the code was that the condition at the end of the do...while loop at Timer A1 interrupt:
 while((TACCR1 - TAR) > INTERVAL);
evaluates to false whenever TACCR1 == TAR.
Not incrementing TACCR1 in this case leads to Timer A1 interrupt not being called for 2 seconds, until TAR counter reaches TACCR1 again after an overflow.

The patch avoids this problem by changing the condition of the loop, and using CLOCK_LT macro to compare between time values.

The patch also attempts to fix another problem: a read of TAR register while it is being updated may return a lower value than the actual contents. To avoid that, the "read twice and compare results" idiom should be used. As the TAR register is updated by the actual hardware, it is of no importance whether it is read with interrupts disabled or enabled; the problem can occur in both contexts.
2014-07-02 11:07:02 +02:00
Rémy Léone f111058472 Removing trailing whitespaces 2014-06-30 20:01:05 +02:00