Commit graph

144 commits

Author SHA1 Message Date
Benoît Thébaudeau 6cdba10b1d Merge pull request #1895 from alignan/pull/fix-cc2538-cca
cpu/cc2538: CCA threshold was fixed
2016-10-28 23:42:18 +02:00
Niclas Finne 3982aee329 Added missing include 2016-10-26 00:04:58 +02:00
Antonio Lignan 2a84e68e6d cpu/cc2538: CCA threshold was fixed 2016-10-18 09:35:04 +02:00
Antonio Lignan 8cc1870663 Zoul: generic servo driver 2016-08-24 14:27:41 +02:00
Antonio Lignan 7ddbe640be Merge pull request #1795 from g-oikonomou/contrib/sensniff
Add generic sensniff example and remove legacy sniffers
2016-08-16 14:47:17 +02:00
Benoît Thébaudeau a52a3d94d3 cc2538: uart: Fix garbled output occurring upon lpm_enter()
lpm_enter() must not enter PM1+ if the UART is transmitting. Otherwise,
the UART clock gets disabled, and its TX is broken.

The commit b8b54a033c had already
partially fixed this issue, but it could still occur while transmitting
stop bits because, contrary to UART_FR.BUSY, UART_FR.TXFE takes only the
data bits into account, not the stop bits.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-08-15 03:07:52 +02:00
Antonio Lignan 1cd39a2621 Merge pull request #1780 from g-oikonomou/bugfix/cc2538/sniffer
Don't flush the CC2538 RF RX FIFO unconditionally
2016-08-12 12:09:12 +02:00
George Oikonomou a932dfa6df Remove built-in sniffer support: CC2538 2016-08-12 01:23:49 +01:00
Benoît Thébaudeau ae5205f9e2 doxygen: Fix orphan modules
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-08-10 04:56:15 +02:00
Sumankumar Panchal 3bb58b7c82 Minor data type correction. 2016-07-22 22:49:49 +05:30
George Oikonomou 568973f6ec Don't flush the CC2538 RF RX FIFO unconditionally
After reading a frame, `read()` checks the status of the RX FIFO:

* If an overflow is detected, the FIFO gets flushed
* If there are more frames in the FIFO, the `cc2538_rf_process` will get polled again in order to read out the next frame.

#1550 changed `read()`, which now performs the above check for non-poll mode, but it then flushes the FIFO unconditionally. Therefore, if there are two or more frames in the FIFO, they will get flushed before the `cc2538_rf_process` has had a chance to read them out. This results in missed frames.

Reproducing this is trivial: Build a CC2538 sniffer and see how it will never show you .15.4 ACK frames. ACK reception completes while `read()` is still streaming the previous captured frame to the host. Upon completion, the FIFO will get flushed and the ACK will get lost.

This pull proposes removing the unconditional flush and reverting to the original logic for non-TSCH operation.

Pinging @thomas-ha here for input regarding poll mode.

This pull sits on top of #1778
2016-07-17 00:24:47 +01:00
George Oikonomou 7fdb9849de Remove unnecessary parentheses 2016-07-16 22:35:23 +01:00
George Oikonomou c359e98bf1 Change mac_timer_init() to static
We also move the function to a different location so we won't have to provide the prototype separately
2016-07-16 17:11:58 +01:00
George Oikonomou 6ef9509dfb Change get_sfd_timestamp() to static
We also move the function to a different location so we won't have to provide the prototype separately
2016-07-16 17:11:57 +01:00
George Oikonomou 833dc89f7c Fix code style 2016-07-16 17:11:57 +01:00
Benoît Thébaudeau 01a533fb75 Merge pull request #1704 from kkrentz/cc2538-aes-fixes
One fix to CC2538 hardware security
2016-06-25 01:30:16 +02:00
Antonio Lignan 6a2d802b9a Merge pull request #1737 from bthebaudeau/cc2538-fix-missing-result-av
cc2538: aes: Fix possibly missing result available status
2016-06-25 00:14:29 +02:00
kkrentz c28b6fb7ba CC2538: Reboot if the crypto engine fails (error handling is too hard) 2016-06-24 01:50:27 -07:00
Benoît Thébaudeau 1da00a482f cc2538: aes: Fix possibly missing result available status
Depending on the use case and on the timings,
aes_auth_crypt_check_status() sometimes never reported an available
result, leading to a deadlock of any protothread waiting for this event,
and to a WDT reset if a protothread was polling it.

This was caused by aes_auth_crypt_start() clearing the result available
interrupt after operations that may rightfully trigger it, leading to a
missed interrupt.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-06-23 22:25:27 +02:00
Benoît Thébaudeau 8a273a248e cc2538: Add configuration for firmware location
Introduce FLASH_CONF_FW_ADDR and FLASH_CONF_FW_SIZE in order to make it
possible to place the firmware anywhere, regardless of Coffee, and
without having to write a custom linker script. Also, handle the default
values properly in order to fix the link breakage reported by
Arthur Fabre <arthur@arthurfabre.com> with COFFEE_CONF_CUSTOM_PORT.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-06-19 23:12:02 +02:00
Benoît Thébaudeau b3ea790449 cc2538: sys-ctrl: Provide last reset cause
Add functions providing the last reset cause, one as an integer (ID),
and one as a string.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-06-11 23:23:38 +02:00
thomas-ha 3a76207b59 Use 64 bit values for MAC timer 2016-04-18 11:40:52 +02:00
thomas-ha 6262025ef3 code style fixes and insert macros from .h 2016-04-15 15:50:20 +02:00
thomas-ha 3bf05d664e moving macros to .c 2016-04-15 15:50:01 +02:00
thomas-ha 5753fb5173 Clean up the driver
Move mac_timer_init() into set_poll_mode() and remove now unneccesary clear outs and mask outs of interrupt sources and pending interrupts
2016-04-07 15:41:15 +02:00
thomas-ha 9ac859a2af add send_on_cca if query 2016-04-07 15:17:44 +02:00
thomas-ha 4e446bc178 fix error 2016-03-23 10:16:06 +01:00
thomas-ha a4f575b8f0 use MAC timer instead of SFD interrupt 2016-03-23 09:08:54 +01:00
thomas-ha fb6e6d9ea3 macros for MAC timer 2016-03-22 18:51:05 +01:00
thomas-ha 66a0bbcd24 renaming variables back to their original name 2016-03-16 16:38:04 +01:00
thomas-ha 217e623337 remove unused variables 2016-03-10 18:09:00 +01:00
thomas-ha 1b185392e4 make cc2538_sfd_rtime volatile 2016-03-08 16:17:40 +01:00
thomas-ha 73d36ebb6b SFD timestamp
Only save SFD timestamp when we are actually receiving.
2016-03-07 18:34:54 +01:00
thomas-ha b0a673ca5c Changes to enable TSCH
poll mode for TSCH including SFD timestamps and send_on_cca
2016-03-07 17:46:53 +01:00
Benoît Thébaudeau 92d8f95cba cc2538: Fix GCC 5 warning
Fix the following warning issued by GCC ARM Embedded 5-2015-q4-major:

  ../../cpu/cc2538/dev/udma.c: In function 'udma_init':
  ../../cpu/cc2538/dev/udma.c:59:10: warning: passing argument 1 of 'memset' discards 'volatile' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
     memset(&channel_config, 0, sizeof(channel_config));
            ^
  In file included from <toolchain-path>/arm-none-eabi/include/string.h:10:0,
                   from ../../platform/cc2538dk/./contiki-conf.h:12,
                   from ../../cpu/cc2538/dev/udma.c:38:
  <toolchain-path>/arm-none-eabi/include/string.h:25:7: note: expected 'void *' but argument is of type 'volatile struct channel_ctrl (*)[4]'
   _PTR  _EXFUN(memset,(_PTR, int, size_t));
         ^

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-09 15:43:20 +01:00
Benoît Thébaudeau f78a132395 cc2538: pka: Fix include paths breakage
The PKA drivers and examples were full of include paths missing the
appropriate prefix, or using angle brackets instead of double quotes or
the other way around.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-09 15:43:13 +01:00
Benoît Thébaudeau ccceb63e88 cc2538: Add crypto driver and example for AES-GCM
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 23:22:54 +01:00
Benoît Thébaudeau e77e9861fe cc2538: Add crypto driver and example for AES-CBC-MAC
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 23:22:53 +01:00
Benoît Thébaudeau 47c24cab11 cc2538: Add crypto driver and example for AES-CTR
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 23:22:53 +01:00
Benoît Thébaudeau cf5e9557f8 cc2538: Add crypto driver and example for AES-CBC
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-06 22:01:41 +01:00
Benoît Thébaudeau 69eacbddbe cc2538: Add AES-CCM* driver
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-04 00:28:27 +01:00
kkrentz 24cb05059a CC2538: Add AES-128 driver 2016-01-04 00:28:27 +01:00
Benoît Thébaudeau 3dbe4c9403 cc2538: Add crypto driver and example for AES-ECB
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-04 00:28:26 +01:00
Benoît Thébaudeau 04890b1899 cc2538: ccm: Allow separate input/output buffers
This is supported by the hardware, so give access to this feature in the
API.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-04 00:28:26 +01:00
Benoît Thébaudeau baef75752e cc2538: aes: Add support for generic operations
Add generic AES functions that should be able to support all the modes
of operation of the hardware AES crypto engine, i.e. ECB, CBC, CTR,
CBC-MAC, GCM, and CCM.

This makes it possible to easily implement these modes of operation
without duplicating code.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-01-04 00:26:32 +01:00
Benoît Thébaudeau 4a6e19ed38 cc2538: pwm: Automatically disable PM1+ if running
The peripheral core clocks of the PWM timers are gated in PM1+, so these
power modes must be disabled if a PWM timer is running. Use
lpm_register_peripheral() to handle this automatically and dynamically.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-12-13 02:39:55 +01:00
Benoît Thébaudeau 9c6d9a7fe0 cc2538: pwm: Fix clock
The peripheral core clock of the general-purpose timers used by the PWM
driver is the system clock, not the I/O clock.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-12-13 02:39:39 +01:00
Antonio Lignan e47b309536 Added note in PWM driver and example about PM0 2015-11-30 09:43:35 +01:00
Antonio Lignan 37fcb927be Added PWM driver for the Zolertia Zoul module and CC2538 platforms 2015-11-25 23:56:29 +01:00
Benoît Thébaudeau 96dd24836c cc2538: Use &vectors instead of flash/.text start address
The current CC2538 linker script in Contiki places the vector table at
the beginning of the flash memory / .text output section. However, this
location is arbitrary (the only requirement is that the vector table is
512-byte aligned), and custom linker scripts may be used with Contiki,
which means that Contiki may be used with a vector table placed
elsewhere. Thus, using the flash/.text start address in the CCA and as
the default NVIC VTABLE value was wrong.

This commit rather uses the address of the vectors[] array from
startup-gcc.c, which makes it possible to freely move around the vector
table without breaking anything or having to use a custom startup-gcc.c
and to configure the NVIC driver for that. Moreover, referencing the
vectors[] array naturally prevents it and its input section from being
garbage-collected by the linker, so this commit also removes the
now-unneeded "used" and "KEEP" keywords from the vector table.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-11-19 01:18:33 +01:00