Fix UDP statistics.
Fix UDP statistics also in ipv6 code.
Merge pull request #350 from AriZuu/udp-stats-fix

Fix UDP statistics.
As RPL Root, drop an incoming DIO from the same instance but different DAG
cc2538: Generate .hex output

ELF files generated by GCC make SmartRF Flash Programmer 2 crash (only the TI
format is supported by this tool for ELFs), and binary files are not very
appropriate because they are gapless, so generate Intel HEX files since these
are very well supported by most programming tools while still flexible.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
cc2538: Make it possible to use a custom linker script

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
cc2538dk: Make it possible to override UIP_CONF_TCP_MSS

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
cc2538: sys_ctrl: Make it possible to use the 32-kHz crystal

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Merge pull request #406 from cetic/hotfix-rplroot-discard-dio

Drop incoming DIO when RPL Root
Merge pull request #413 from ADVANSEE/cc2538-build

cc2538: Various build improvements
Merge pull request #410 from ADVANSEE/cc2538-sys_ctrl

cc2538: sys_ctrl: Make it possible to use the 32-kHz crystal
cc2538: lpm: Add registration mechanism for peripherals

Some peripherals have their clocks automatically gated in PM1+ modes, so they
cannot operate. This new mechanism gives peripherals a way to prohibit PM1+
modes so that they can properly complete their current operations before
entering PM1+.

This mechanism is implemented with peripheral functions registered to the LPM
module. These functions return whether the associated peripheral permits or not
PM1+ modes. They are called by the LPM module each time PM1+ might be possible.
If any of the peripherals wants to block PM1+, then the system is only dropped
to PM0.

Partly from: George Oikonomou
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
cc2538: usb: Use the new LPM peripheral registration

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
cc2538: uart: Fix crippled output occurring upon lpm_enter()

lpm_enter() must not enter PM1+ if the UART TX FIFO is not empty. Otherwise, the
UART clock gets disabled, and its TX is broken.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Fix rpl-udp build failure on native target, reported on contiki mailing list

http://sourceforge.net/mailarchive/forum.php?thread_name=a2b9cb98ac4a191867afc953113fabaa%40amnesiak.org&forum_name=contiki-developers
cc2538: gpio: Fix usage of parameters in macros

The parameters in the GPIO macros were used without being parenthesized. This
could generate wrong values for register assignments in the case of expressions
passed as arguments to these macros.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
cc2538: gpio: Add pin read / write and interrupt clear macros

Introduce new useful GPIO macros to:
 - read the levels of some port pins,
 - write the levels of some port pins (pass bit-field value to be set),
 - clear the interrupt flags for some port pins.

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@advansee.com>
cc2538: gpio: Use accessor macros

Use the GPIO accessor macros instead of copying raw register access code all
over the place. This is cleaner and less error prone.

This fixes the setting of the USB pull-up resistor that worked only by chance on
the CC2538DK because it is controlled by the pin 0 of the used GPIO port.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Merge pull request #408 from ADVANSEE/cc2538-uart

cc2538: lpm: Add registration mechanism for peripherals and use it
Merge pull request #425 from ADVANSEE/cc2538-gpio

cc2538: gpio: Bug fix and various improvements