Commit Graph

1717 Commits

Author SHA1 Message Date
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
Michael LeMay
bde8eb35ae x86, galileo: Fix UART system call authorization initialization
This patch fixes UART system call authorization initialization (when
protection domain support is enabled) to only initialize the system call
entrypoint and authorization data structures once, prior to per-port
setup. Previously, if two UARTs were configured, the setup procedure for
the second UART would erase the system call authorization for the
first (console) UART, resulting in a crash upon the next attempt to
perform console output.
2016-08-04 16:09:44 -07:00
Michael LeMay
31ad67abd7 x86: Support configurable UART baud rate
This patch extends the Intel Quark X1000 SoC UART initialization API to
accept a numeric baud rate specification.
2016-08-03 07:58:51 -07:00
Simon Duquennoy
cda89aaaf2 Merge pull request #1217 from tiagoshibata/c64_compilation_fixes
Fixes compilation targeting c64
2016-07-25 14:57:24 +02:00
George Oikonomou
8ab0522cec Fix PROP mode channel switching
If `NETSTACK_CONF_RADIO.set_value(RADIO_PARAM_CHANNEL, ...)` is called when radio is on, it will fail to apply the channel change, because it won't re-send `CMD_PROP_RADIO_DIV_SETUP` and `CMD_PROP_FS`. This commit fixes this condition, by making sure the correct commands are sent to the radio.
2016-07-24 03:39:13 +01:00
Sumankumar Panchal
3bb58b7c82 Minor data type correction. 2016-07-22 22:49:49 +05:30
George Oikonomou
2039b3a552 Use ccaInfo.ccaState to decide whether CCA is complete
This commit changes the logic of `get_cca_info()` in the CC26xx IEEE mode driver. We now use the command's return status bits to determine whether the radio's CCA monitoring function has concluded, instead of drawing conclusions based on RSSI readings.
2016-07-17 20:19:13 +01:00
George Oikonomou
16f56abfad Wait for a valid RSSI reading in CC13xx/CC26xx RF drivers
As discussed in #1341, the current CC13xx/CC26xx IEEE mode driver sends `CMD_GET_RSSI` once and returns the RSSI reading uncondtionally. This happens within the `get_rssi()` function.

This logic is broken if `get_rssi()` is called with the radio off. The function will make sure to turn on the radio first, but it does not make sure the RSSI reading is valid, which only happens a number of symbol periods after the radio enters RX. The outcome is that `NETSTACK_RADIO.get_value(RADIO_PARAM_RSSI, ...)` will always return -128 (meaning that RSSI is unavailable) if the radio was off at the time of calling the function.

The same condition affects the prop mode driver.

This commit changes the logic of `get_rssi()`:
* For PROP mode, if `CMD_GET_RSSI` returns an invalid RSSI, we send it again. For unknown reasons, `CMD_GET_RSSI` on occasion returns 0, so we ignore that value too.
* For IEEE mode, we use `CMD_IEEE_CCA_REQ` and we inspect the value of `ccaInfo.ccaEnergy` of the return structure. If the value is 0x02 (Invalid), we send the command again.

Fixes #1341
2016-07-17 18:20:22 +01:00
George Oikonomou
eec890d60e Update CC26xxware to v2.24.02.17202 2016-07-17 00:26:52 +01:00
George Oikonomou
fd82603786 Update CC13xxware to v2.04.02.17240 2016-07-17 00:26:52 +01:00
George Oikonomou
dc1f9fe010 Simplify MODESEL value determination 2016-07-17 00:26:52 +01:00
George Oikonomou
4495d14702 Make ROM bootloader configurable through contiki- or project-conf.h 2016-07-17 00:26:52 +01:00
George Oikonomou
ccba6bdb20 Update cpu files to reflect API in latest CCxxware versions 2016-07-17 00:26:51 +01:00
George Oikonomou
0e4c02bf3b Update ChipInfo and OSC macros 2016-07-17 00:25:18 +01:00
George Oikonomou
f68b77fdfa Remove ROM AUX timer macros
They have been undefined in CCxxwares
2016-07-17 00:25:17 +01:00
George Oikonomou
171fe8d08e Adjust GPIO macros to reflect API in latest CCxxware 2016-07-17 00:25:17 +01:00
George Oikonomou
788cb1e119 Move ROM function macros to separate file 2016-07-17 00:25:17 +01:00
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
Benoît Thébaudeau
c05665a16b Merge pull request #1778 from g-oikonomou/contrib/cc2538/rf-driver-code-style
Improve code style of the CC2538 RF driver
2016-07-17 01:22:21 +02:00
George Oikonomou
dcad5e7e3f Merge pull request #1727 from g-oikonomou/contrib/cc26xx/trng
Add CC13xx/CC26xx TRNG Support
2016-07-16 23:34:53 +01:00
George Oikonomou
7fdb9849de Remove unnecessary parentheses 2016-07-16 22:35:23 +01:00
Atis Elsts
2fe4b4d5bb CC26xx: enable MCU sleeping while transmitting if and only if not in poll mode 2016-07-16 18:22:20 +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
George Oikonomou
0313f9abf1 Merge pull request #1751 from atiselsts/bugfix/cc26xx_etimer_sleep
CC26xx: fix a regression in and refactor LPM code
2016-07-16 14:45:56 +01:00
Antonio Lignan
23a0449a97 Merge pull request #1753 from g-oikonomou/bugfix/cc26xx/missing-include
Add missing include
2016-06-30 22:53:45 +02:00
Atis Elsts
b6617f17c5 CC26xx: always request HF crystal oscillator at radio on() 2016-06-29 16:41:33 +03:00
Atis Elsts
9caaf26012 CC26xx: fix a regression in and refactor LPM code 2016-06-29 01:03:06 +03: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
George Oikonomou
de18c16c9f Add CC13xx/CC26xx RNG support to the build 2016-06-15 10:32:03 +01:00
George Oikonomou
fd9d878e1d Implement random.h API for the CC13xx/CC26xx 2016-06-15 10:32:03 +01:00
George Oikonomou
bb4056903c Add CC13xx/CC26xx TRNG driver 2016-06-15 10:32:03 +01:00
George Oikonomou
f8864c67fd Add TRNG CCxxware macros 2016-06-15 10:30:17 +01:00
Atis Elsts
e233c3f27f cc26xx: change CCA logic to be standard-compatible; change receiving_packet to return true iff sync (SFD) has been seen 2016-06-14 00:54:33 +03:00
Atis Elsts
d85667d535 cc26xx: packet queue changes: allow to read packets after radio has been turned off; make pending_packet() return true when there is a packets being received 2016-06-14 00:54:33 +03:00
Atis Elsts
54e4b5f351 cc26xx: allow IEEE 802.15.4 frames with version 2, required for TSCH 2016-06-14 00:54:33 +03:00
Atis Elsts
80aa30c5da cc26xx: add support for RADIO_PARAM_TX_MODE getting and setting and for LAST_RSSI and LAST_LQI reading 2016-06-14 00:54:33 +03:00
Atis Elsts
25c5f0b744 cc26xx: implement support for CC2650_FAST_RADIO_STARTUP 2016-06-14 00:54:33 +03:00
Atis Elsts
97c1cfc3b4 cc26xx: return the expected value 0 from prepare() in ieee and prop mode radio 2016-06-14 00:54:33 +03:00
Atis Elsts
e19fbc996e cc26xx: use CMD_IEEE_MOD_FILT to change address filtering instead of fully restarting the radio 2016-06-14 00:54:33 +03:00
Atis Elsts
3a99639294 cc26xx: implement CC2650_FAST_RADIO_STARTUP option, required for TSCH 2016-06-14 00:54:33 +03:00
Atis Elsts
a47fb723e4 cc26xx: enable sync between radio timer and RTC, useful for TSCH 2016-06-14 00:54:33 +03:00
Atis Elsts
95b66657aa cc26xx: add TSCH-related rtimer defines 2016-06-14 00:54:32 +03:00
Atis Elsts
ac6f8008fd cc26xx: implement poll mode, hardware timestamps, and other minor changes in the IEEE radio driver 2016-06-14 00:54:32 +03:00
George Oikonomou
678f4344d2 Add missing include 2016-06-13 12:04:47 +01:00
Tiago Koji Castro Shibata
c2a0f739f7 Compilation targeting c64
Adds some casts required by cc65 compiler and small fixes
2016-06-12 21:16:01 -03:00
Benoît Thébaudeau
b655d92aa4 cc2538: Provide SoC information
Add functions providing the SoC revision, SRAM size, and enabled
hardware features, as well as a function printing SoC information.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-06-11 23:23:38 +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
Antonio Lignan
ee0b02c819 Merge pull request #1684 from g-oikonomou/contrib/cc26xx/aux-ctrl-and-adc
Add CC13xx/CC26xx AUX controller module, ADC support, ALS driver and example
2016-06-07 14:36:28 +02:00
Antonio Lignan
b3faefe602 Merge pull request #1433 from mdlemay/x86-mm
X86 memory management
2016-06-05 13:49:49 +02:00
Oliver Schmidt
0151a7c27e Merge pull request #1706 from oliverschmidt/master
Make use of new cl65 option --print-target-path.
2016-06-03 15:13:08 +02:00
Oliver Schmidt
ae0c5f0dd0 Make use of new cl65 option --print-target-path.
The new cl65 option --print-target-path allows to get rid of CC65_HOME altogether.
2016-06-03 13:30:25 +02:00
Simon Duquennoy
26bf33c762 Merge pull request #1550 from thomas-ha/tsch-cc2538-port
Port of TSCH for CC2538
2016-06-02 21:33:55 +02:00
Antonio Lignan
6fc4e2535c Merge pull request #1665 from g-oikonomou/contrib/cc26xx-bsl
Consolidate .upload for all CC26xx/CC13xx boards and add login make target
2016-06-01 23:37:29 +02:00
Antonio Lignan
9e1c378919 Merge pull request #1469 from wbober/nrf52dk-pr
Add support for nRF52 DK platform
2016-06-01 23:11:39 +02:00
Antonio Lignan
f065971efc Merge pull request #1619 from simonduq/pr/tsch-rtimer16-fix
Fix bug in TSCH for platforms with 16-bit rtimer
2016-06-01 23:03:50 +02:00
Benoît Thébaudeau
09a7566e01 cc2538: coffee: Add default micro-log configuration
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-05-30 23:05:14 +02:00
Benoît Thébaudeau
bd961d1cd3 cc2538: Fix possible linker script breakage
The conditional definitions in project-conf.h depending on
CONTIKI_TARGET_<TARGET_NAME> were ignored at link time, which broke the
linker script if it used these definitions, so the flashed applications
could crash or malfunction.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2016-05-30 23:05:14 +02:00
Atis Elsts
487547d8af Add CC13xx/CC26xx ADC driver 2016-05-29 14:30:07 +01:00
George Oikonomou
43b8bf3d30 Add CCxxware macros for AUX ADC 2016-05-29 14:30:07 +01:00
George Oikonomou
6b40b1b965 Change LPM to power up/down AUX through the AUX controller 2016-05-29 14:30:07 +01:00
George Oikonomou
812f1ada31 Manipulate OSC modules using the AUX controller 2016-05-29 14:28:59 +01:00
George Oikonomou
698ce3a865 Add the AUX controller to the build 2016-05-28 17:37:01 +01:00
George Oikonomou
08dc4b0b21 Add controller for the AUX domain 2016-05-28 17:37:01 +01:00
George Oikonomou
3a34b1f695 Merge pull request #1531 from bkozak-scanimetrics/cc26xx_cc13xx_lpm_fixes
Fixed numerous bugs in CC26xx-CC13xx lpm
2016-05-24 16:45:20 +01:00
Atis Elsts
b608b837c2 Add login target to Makefile.cc26xx-cc13xx 2016-05-18 22:10:56 +01:00
George Oikonomou
c5bea81bb6 Merge pull request #1530 from herjulf/avr-rss2
Adding AtMegaXXRFR2 support and avr-rss2 platform
2016-05-15 20:38:50 +01:00
Robert Olsson
18876a1fae Adding CRC valid check in rf230bb radios registermaps 2016-05-15 14:15:46 +02:00
George Oikonomou
cd5a0ef291 Consolidate .upload for all CC26xx/CC13xx boards
The block that controls the `.upload` target is unnecessarily replicated in multiple sub-board Makefiles. This was originally done because the SmartRF and the Launchpad can be programmed with the c2538-bsl script, whereas the sensortag cannot.

This commit moves the `cc2538-bsl` / `.upload` target logic to the top level cpu Makefile (`cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx`). Board makefiles simply set the make variable `BOARD_SUPPORTS_BSL` to 1 to signal that they can be programmed by the BSL script. If `BOARD_SUPPORTS_BSL` is not equal to 1, trying to use the `.upload` target will return an error message.

For example:

```
$ make BOARD=sensortag/cc2650 cc26xx-demo.upload
using saved target 'srf06-cc26xx'
This board cannot be programmed with the ROM bootloader and therefore does not support the .upload target.
```
2016-05-14 19:30:53 +01:00
Jens Dede
7f80b1ad57 Remove include of stdio.h 2016-05-04 11:12:37 +02:00
Jens Dede
59afae85e2 Use if instead of ifdef. Is more contiki standard-compliant 2016-05-02 22:34:58 +02:00
Jens Dede
119291d083 Fix putchar include when using IPv4 2016-05-02 19:13:26 +02:00
Simon Duquennoy
bb5e5d5c6b TSCH: use RTIMER_CLOCK_DIFF to compute estimated drift, fixing a bug that would occur on 16-bit rtimer platforms 2016-04-27 14:13:33 +02:00
Michael LeMay
73774def6b x86, galileo: Add sample non-driver protection domain
This patch adds a simple non-driver protection domain sample to serve
as an example for defining other non-driver protection domains.  It
simply performs a ping-pong test of protection domain switching
latency during boot, including optional accesses to a private metadata
region, and prints out the results.
2016-04-22 08:16:43 -07:00
Michael LeMay
e0aefd11d9 x86: Add support for SW-switched segment-based protection domains
This patch extends the protection domain framework with a third plugin
that is a hybrid of the previous two.  The hardware task switching
mechanism has a strictly-defined format for TSS data structures that
causes more space to be consumed than would otherwise be required.
This patch defines a smaller data structure that is allocated for each
protection domain, only requiring 32 bytes instead of 128 bytes.  It
uses the same multi-segment memory layout as the TSS-based plugin and
leaves paging disabled.  However, it uses a similar mechanism as the
paging plugin to perform system call dispatches and returns.

For additional information, please refer to cpu/x86/mm/README.md.
2016-04-22 08:16:43 -07:00
Michael LeMay
4cdb7ba9b6 x86: Add TSS-based protection domain support
This patch extends the protection domain framework with an additional
plugin to use Task-State Segment (TSS) structures to offload much of
the work of switching protection domains to the CPU.  This can save
space compared to paging, since paging requires two 4KiB page tables
and one 32-byte page table plus one whole-system TSS and an additional
32-byte data structure for each protection domain, whereas the
approach implemented by this patch just requires a 128-byte data
structure for each protection domain.  Only a small number of
protection domains will typically be used, so
n * 128 < 8328 + (n * 32).

For additional information, please refer to cpu/x86/mm/README.md.

GCC 6 is introducing named address spaces for the FS and GS segments
[1].  LLVM Clang also provides address spaces for the FS and GS
segments [2].  This patch also adds support to the multi-segment X86
memory management subsystem for using these features instead of inline
assembly blocks, which enables type checking to detect some address
space mismatches.

[1] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html
[2] http://llvm.org/releases/3.3/tools/clang/docs/LanguageExtensions.html#target-specific-extensions
2016-04-22 08:16:39 -07:00
George Oikonomou
00d5645d16 Merge pull request #1601 from philrhinehart/bugfix-cc26xx-ble-events
cc26xx-cc13xx BLE beacon event issue
2016-04-18 20:06:33 +01:00
thomas-ha
3a76207b59 Use 64 bit values for MAC timer 2016-04-18 11:40:52 +02:00
Phil Rhinehart
5d5544151f Fixed bug in cc26xx-cc13xx rf-core. When running BLE in conjunction with ContikiMAC, oscillators were modified from an interrupt state causing occasional bus faults and infinite loops. We now check if BLE is active prior to modifiying the oscillators to avoid these conditions. 2016-04-18 17:17:07 +08:00
Phil Rhinehart
2a07dc0e0a This fixes an event handling issue in the cc26xx BLE driver. Currently, the rf_ble_beacon_process triggers the BLE beacon upon receiving any event, rather than verifying that the event timer has expired. This means that any PROCESS_BROADCAST (e.g. any sensor event) will fire the beacon. This commit adds logic to prevent this. 2016-04-18 17:14:37 +08: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
Oliver Schmidt
2c48f3b232 Added compatibility with W5100 shared access.
If the setup of socket 0 to 3 with 4+2+1+1KB is detected then the W5100 is _not_ initialized, otherwise it does set up socket 0 and 1 with 4KB each. Either way socket 0 is used - now with 4KB instead of 8KB as before.
2016-04-05 21:11:19 +02:00
Oliver Schmidt
4f28289df2 Added a pfs_remove() function and a pfs_seek() stub to the Commodore platforms.
- "Normalized" some Assembly code.
- Implemented CFS_APPEND in pfs_open().
- Made CFS_WRITE work in VICE's virtual disk/file system.
2016-03-28 14:07:35 +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
Michael LeMay
3908253038 x86: Add support for (paging-based) protection domains
This patch implements a simple, lightweight form of protection domains
using a pluggable framework.  Currently, the following plugin is
available:

 - Flat memory model with paging.

The overall goal of a protection domain implementation within this
framework is to define a set of resources that should be accessible to
each protection domain and to prevent that protection domain from
accessing other resources.  The details of each implementation of
protection domains may differ substantially, but they should all be
guided by the principle of least privilege.  However, that idealized
principle is balanced against the practical objectives of limiting the
number of relatively time-consuming context switches and minimizing
changes to existing code.

For additional information, please refer to cpu/x86/mm/README.md.

This patch also causes the C compiler to be used as the default linker
and assembler.
2016-03-21 17:18:06 -07:00
Michael LeMay
b0de416682 x86: Adjust UEFI header size
The UEFI GenFw program inserts headers ahead of the code in the UEFI
binary.  The linker script adjusts the starting address of the .text
section to account for that.  This prevents the symbols from being
perturbed.  This patch accounts for a recent change in the size of the
headers added by the GenFw program.
2016-03-21 17:18:06 -07:00
Michael LeMay
93126b57bb x86, galileo: Use IMRs to restrict DMA
This patch configures Isolated Memory Regions (IMRs) to block DMA to
code and data regions that do not contain any data that needs to be
DMA-accessible.
2016-03-17 08:35:49 -07:00
Michael LeMay
58a00b7c23 x86, galileo: Add driver for Isolated Memory Regions (IMRs)
The Intel Quark X1000 SoC includes support for Isolated Memory Regions
(IMRs), which are specified using range registers and associated
control registers that are accessible via the message bus.  This patch
adds a driver for accessing those registers.
2016-03-17 08:35:49 -07:00
Michael LeMay
25c07613c2 x86: Add driver for message bus
The Intel Quark X1000 SoC includes a message bus that is accessible
via PCI configuration registers.  It communicates to various SoC
components such as the Isolated Memory Region (IMR) registers and the
Remote Management Unit.  This patch adds a driver for accessing the
message bus.
2016-03-17 08:35:48 -07:00
thomas-ha
66a0bbcd24 renaming variables back to their original name 2016-03-16 16:38:04 +01:00
Nicolas Tsiftes
9ab327090c Merge pull request #1444 from mdlemay/galileo-always-init-gpio
galileo: Enable I2C and GPIO interrupt sharing and centralize their initialization
2016-03-14 20:09:40 +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
Simon Duquennoy
dea04c67d7 Change the default IPv6 prefix from aaaa::/64 to fd00::/64 2016-03-07 17:47:44 +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
thomas-ha
b4c2cd9619 Macros for TSCH
US_TO_RTIMERTICKS(US) and RTIMERTICKS_TO_US(T)
2016-03-07 17:25:40 +01:00
Billy Kozak
786aa19cbd Fixed numeruous bus in CC26xx-CC13xx lpm
Bug fixes include:
- keep interrupts disabled during lpm_sleep() so that we don't
  miss any interrupts we may have been expecting
- check that the pending etimer isn't already expired (and don't sleep
  at all if it is)
- check that the about-to-be scheduled rtimer wakeup is neither too
  far into  the future nor too close into the future (or even in the
  past) before actually setting the interrupt (should fix #1509); If
  the time is out of bounds we use a default min or max value instead.
- Correctly handle LPM_MODE_MAX_SUPPORTED set to zero (and added a
  macro for the zero value) so that sleeping can be disabled altogether
- If no etimer is set, we specify a wakeup time which is reasonably far
  into the future instead of setting none at all (this will save on
  power consumption whenever no etimers are set).

Also did a bit of refactoring in that some long functions were broken
into multiple functions.
2016-02-23 10:41:01 -07:00
Robert Olsson
d3980668ee Adding support for AtMega128RFR2 and AtMega256RFR2 2016-02-22 20:14:06 +01:00
Michael LeMay
58874ea25d x86, galileo: Refactor I2C and GPIO initialization
This patch revises the I2C and GPIO initialization code to always be
run during platform boot rather than within each process that requires
it.

This patch also revises the gpio-output example to use a pin that is
set as an output by the default pinmux configuration.  Previously, it
used a pin that was set as an output by the pinmux configuration that
is in effect when the OS does not change the pinmux configuration.
2016-02-16 21:19:44 -08:00
Michael LeMay
c815fa4511 x86: Use shared ISR for I2C and GPIO
This patch permits interrupts to be generated by both the I2C and GPIO
controllers for simultaneously-executing applications. The controllers
share a single interrupt pin, INTC. Prior to this patch,
quarkX1000_gpio_init() routed INTA to PIRQC and IRQ 10 (due to an
incorrect assumption that INTA is connected to the GPIO controller),
and quarkX1000_i2c_init() routed INTC to PIRQC and IRQ 9. The I2C
controller initialization is a prerequisite for GPIO initialization,
so the final configuration was that INTA and INTC were both routed to
PIRQC and IRQ 10. Thus, only the GPIO ISR was being invoked, even if
the I2C controller was actually responsible for the interrupt.

This patch refactors the I2C and GPIO ISR setup and handler code so
that the shared portions are combined in
cpu/x86/drivers/legacy_pc/shared-isr.[ch].  The I2C and GPIO drivers
communicate their interrupt information to the shared component by
placing structures in a specific section of the binary.
2016-02-16 21:19:44 -08:00
Wojciech Bober
20f9515ed1 nrf52dk: cpu/nrf52832 support 2016-02-15 09:37:38 +01:00
George Oikonomou
d42b1b50e5 Allow the caller to access the entire content of CMDSTA
When sending a command to the CC13xx/CC25xx RF core, we wait for command completion by checking the LSB of CMDSTA (correctly so). However, in doing so we also zero out the 3 CMDSTA return bytes. For some commands, those bytes contain useful information (e.g. an RSSI value) and are required by the caller.

This problem manifests itself e.g. in PROP mode `channel_clear()`, whereby the caller will always see an RSSI value of 0.

This pull therefore fixes the logic in `rf_core_send_cmd()` to check for command completion by blocking on the CMDSTA result byte without zeroing out the 3 return bytes.

Fixes #1465
2016-01-24 13:39:14 +00:00
George Oikonomou
707353f71b Remove Sensinode platform, cpu, example and tools files
This is part of a set of commits that will obsolete the Sensinode platform
2016-01-10 15:01:58 +00:00
George Oikonomou
ab59a387b3 Merge pull request #1371 from g-oikonomou/bugfix/cc26xx/lpm-operation
Improve the stability of CC13xx/CC26xx low-power operation
2016-01-09 18:07:47 +00:00
George Oikonomou
b97a3d1049 Merge pull request #1242 from g-oikonomou/contrib/cc26xx-ieee-volatile-cmd-ieee-tx
Use volatile access for CMD_IEEE_TX
2016-01-09 18:01:40 +00:00
George Oikonomou
3a831cbebf Merge pull request #1322 from g-oikonomou/bugfix/cc26xx/interrupt-flag-management
Clear CC26xx/CC13xx interrupt flags selectively
2016-01-09 18:01:15 +00:00
George Oikonomou
109696174f Merge pull request #1350 from g-oikonomou/bugfix/cc26xx/tx-power
Correctly set new CC26xx TX power when the RFC is powered off
2016-01-09 17:59:24 +00:00
George Oikonomou
fa002c2d73 Merge pull request #1321 from g-oikonomou/bugfix/cc26xx/remove-redundant-reads
Remove redundant function calls in CC13xx/CC26xx RFC code
2016-01-09 17:52:15 +00: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
Michael LeMay
52d75dce0d x86: Remove spurious UEFI-related info message
This patch removes a spurious info message in a UEFI-related portion
of a Makefile.
2015-12-21 08:06:14 -02:00
Michael LeMay
0e99ebbded x86: Add support for 32-bit build hosts in build_uefi.sh
This patch adds support for building the UEFI EDK2 tools on 32-bit
hosts.  It also revises the script to support rebuilding the tools
when the script is re-invoked after the EDK2 repository has previously
been downloaded.
2015-12-21 08:06:14 -02:00
Michael LeMay
e297177a69 x86: Streamline MMIO accesses in GPIO and I2C drivers
This patch refactors the MMIO routines in the GPIO and I2C drivers to
eliminate the base_addr parameter that specifies the MMIO base
address.  Instead, just the MMIO routines themselves retrieve the base
address from the driver structure.
2015-12-21 08:06:14 -02:00
Michael LeMay
f85654a82f x86, galileo: Add UEFI support
This patch adds support for optionally building EFI binaries in
addition to Multiboot ELF binaries.  It includes a script,
build_uefi.sh, that downloads tool and library sources from the EDK II
project, builds the GenFw tool that is used to create UEFI binaries,
and creates a makefile that is included from the main x86 common
makefile and enables UEFI support in the Contiki build system.  If the
script is not run prior to building Contiki, then an informational
message will be displayed with instructions for running build_uefi.sh
if UEFI support is desired.  This patch also adds the path to the
auto-generated makefile to .gitignore.

This patch modifies the linker script for the Intel Quark X1000 to
account for the output file section offsets and alignment expectations
of the EDK II GenFw project.

This patch also adds a newlib patch to remove the weak symbol
attribute from floating point stdio support routines.  See
<newlib>/newlib/README for an explanation of how the newlib developers
intended for _printf_float and _scanf_float to be linked.  Newlib
declares them as weak symbols with the intention that developers would
force them to be linked only when needed using a linker command line
option.  However, some but not all Contiki programs require them, so
we cannot simply always include or exclude them.  Instead, we remove
the weak symbol attributes and rely on the linker to automatically
determine whether or not they should be linked.  This avoids an issue
in which weak symbols were undefined in the intermediate DLL generated
as part of the UEFI build process.  That resulted in the GenFw program
emitting "ERROR 3000" messages when it encountered relocations
referencing such an undefined symbol.

Finally, this patch updates README.md to both make some revisions to
account for the UART support introduced in previous patches as well as
to provide instructions for using the UEFI support.
2015-12-21 08:06:14 -02:00
Michael LeMay
b915e7d5e3 galileo: Omit exception handling unwind tables
This patch modifies the newlib and Contiki C and C++ compiler flags to
omit exception handling unwind tables (see
http://wiki.dwarfstd.org/index.php?title=Exception_Handling).
Removing these tables saves space in debug builds and has not caused
any readily-apparent functional changes.

Here is the size listing for an example program built without this
patch:
   text	   data	    bss	    dec	    hex	filename
  76002	   1508	  21224	  98734	  181ae	all-timers.galileo

Here is the size listing for the same program with this patch:
   text	   data	    bss	    dec	    hex	filename
  72918	   1508	  21224	  95650	  175a2	all-timers.galileo

The primary motivation for this patch is to help enable UEFI support.
The .eh_frame and .eh_frame_hdr sections that are otherwise generated
are treated as code sections by the EDK2 GenFw program, since they are
read-only alloc sections.  They get grouped with the actual code
sections, ahead of the data sections.  This perturbs symbols and
complicates debugging.
2015-12-21 08:06:14 -02:00
Michael LeMay
abeed93da5 x86: Add driver for Intel Quark X1000 built-in Ethernet
This patch adds a simple, space-efficient driver for the Ethernet
interface built into the Intel Quark X1000.  It only allocates a
single packet descriptor for each of the transmit and receive
directions, computes checksums on the CPU, and enables
store-and-forward mode for both transmit and receive directions.
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga
4726bc3313 x86: Add Intel Quark X1000 GPIO Controller (non-legacy) interrupt support
Since Galileo pinmux is available, this patch adds interrupt support
for GPIO Controller (non-legacy).
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga
495dcd659a x86: Add PCAL9535A support
This patch adds gpio-pcal9535a.c and gpio-pcal9535a.h files,
which support access to I2C-based PCAL9535A GPIO controller
configuration register through a function interface.

The PCAL9535A is a low-voltage 16-bit GPIO expander with interrupt
and reset for I2C-bus/SMBus applications. It contains the PCA9535
register set of four pairs of 8-bit Configuration, Input, Output,
and Polarity Inversion registers, and additionally, the PCAL9535A has
Agile I/O, which are additional features specifically designed to
enhance the I/O. More about PCAL9535A can be found in its datasheet[1].

This driver is needed in order to configure Galileo pinmux.

[1] - http://www.nxp.com/documents/data_sheet/PCAL9535A.pdf
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga
a27af5b395 x86: Add Intel Quark X1000 I2C support
This patch adds the i2c.c, i2c.h and i2c-registers.h files,
which support access to I2C controller configuration register
through a function interface.
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga
2d552285cd x86: Add Intel Quark X1000 GPIO Controller (non-legacy) support
This patch adds the gpio.c and gpio.h files, which support
access to GPIO Controller (non-legacy) configuration register
through a function interface.

It doesn't add interrupt support due to pinmux reasons. On
Galileo Gen 2 we need to configure a pin as input/interrupt
using pinmux and this can only be achieved through I2C. There's
one pin exported by default as GPIO output and we used this one
to test this driver.

In the future, we plan to add an I2C driver and a pinmux configuration
driver in order to solve this kind of problems.
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga
60f6edef80 x86: Add support for PCI BAR1
This patch adds support for PCI BAR1 and also changes
the pci_init(), instead of having one function for each `bar`
we now set the `bar` to pci_config_addr_t parameter before calling
the pci_init() function..
2015-12-21 08:06:14 -02:00
Michael LeMay
6dc27579bc x86: Extend PCI driver module with support for metadata and configuration writes
This patch adds the 'meta' field to the generic driver structure to
point to optional driver-defined metadata.  It also modifies the
associated initialization routine to populate it and updates the 16X50
UART driver to use the new initialization routine signature.  This
patch also adds a function to perform PCI configuration register
writes, definitions for the PCI Command configuration register address
and some of the bits in that register, and a function to set
additional bits in that register.  Finally, it adds macros to help
with performing MMIO to and from PCI devices.
2015-12-21 08:06:14 -02:00
Andre Guedes
c6ef8454a1 x86: Use -O0 instead of -Og for debug build
This patch replaces the gcc option '-Og' by '-O0' which is used when
building debugging binaries. The motivation for this change comes
from the fact that we have found at least one optimization done by
'-Og' that interfered with one of our debugging sessions.
2015-12-21 08:06:14 -02:00
Andre Guedes
6b433aede1 x86: Improve release binary size
This patch adds -ffunction-sections and -fdata-sections to the
'release' CFLAGS so each function and data is place into its
own section in the output file. It also adds --gc-section to
the 'release' LDFLAGS so the linker removes the sections which
are not referenced.

This patch also adds -ffunction-sections and -fdata-sections
options to CFLAGS from build_newlib.sh. This increases newlib
static libraries size, however, the Contiki image shrinks even
more since --gc-section removes "dead code" from newlib.

As a practical effect, all unused function and data (as well as
sections such as .eh_frame) are striped out from the final elf
binary. This shrinks our release binary drastically.

Finally, to prevent --gc-section from removing .multiboot section,
this patch adds KEEP(*(.multiboot)) to quarkX1000.ld.
2015-12-21 08:06:14 -02:00
Ricardo de Almeida Gonzaga
c796e270bf x86: Add Intel Quark X1000 PCI Interrupt Routing support
PCI Interrupt Routing is mapped using Interrupt Queue Agents
IRQAGENT[0:3] and aggregating the INT[A:D] interrupts for each
PCI-mapped device in the SoC.

PCI based interrupts PIRQ[A:H] are then available for consumption
by either the 8259 PICs or the IO-APIC, depending on the configuration
of the 8 PIRQx Routing Control Registers PIRQ[A:H].

More information about can be find in Intel Quark X1000 datasheet[1]
section 21.11.

[1] - http://www.intel.com/content/www/us/en/embedded/products/quark/quark-x1000-datasheet.html
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia
8ae392e66f x86: Reduce .eh_frame section size
When generating binaries, gcc will always add information of what it
calls "the exception handler framework" into its own section: .eh_frame.
This section is based on the DWARF format's call frame information (CFI) [1]
and holds information that can be useful for debuggers but also for language
constructs that relies on always having stack unwinding information (i.e. exceptions).
Such constructs, however, are pretty much useless for the C language and are
mainly just used on C++. Furthermore, this section is one of the loadable sections
of a binary, meaning it will take extra space on flash.

When .eh_frame is not present, debuggers can still get the exact same information
they need for unwinding a stack frame and for restoring registers thanks to yet
another section: .debug_frame. This section is generated by '-g' gcc option and
friends. It is actually defined by DWARF and, as opposed to .eh_frame, is not a
loadable section. In other words, it is 'strippable' while .eh_frame is not.

Since all we need is the debug information we can get from .debug_frame, we can
disable the generation of these large and unused information tables by using gcc's
'-fno-asynchronous-unwind-tables'. The .eh_frame section stays around but the code
size issue is heavily tackled. This is the same approach taken on other projects
that target small code size generation [2] [3].

Pratically speaking, on a DEBUG build of the all-timers appplication, before this
patch we had:
   text    data     bss     dec     hex filename
  21319    1188   12952   35459    8a83 all-timers.galileo

And now, after this patch:
   text    data     bss     dec     hex filename
  16347    1188   12952   30487    7717 all-timers.galileo

This means a ~5Kb reduction on the loadable text segment (.text + .rodata + .eh_frame).

The flag is applied regardless of build type, DEBUG or RELEASE, since it benefits both.
Note that when release builds apply --gc-sections, they will remove .eh_frame section entirely.

[1] http://comments.gmane.org/gmane.comp.standards.dwarf/222
[2] 0d74ad383b
[3] http://git.musl-libc.org/cgit/musl/commit/?id=b439c051c7eee4eb4b93fc382f993aa6305ce530
[4] https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html

Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2015-12-21 08:06:14 -02:00
Michael LeMay
0dcd5e9b5a x86: Revise CFLAGS and LDFLAGS for LLVM Clang compatibility
This patch slightly revises CFLAGS and LDFLAGS to specify the
optimization and debugging options and linker script in a way that is
compatible with using Clang as the C compiler and to invoke the linker
(i.e. CC = clang and LD = clang).
2015-12-21 08:06:14 -02:00
Michael LeMay
128d9f3566 x86: Revise SET_INTERRUPT_HANDLER to avoid using inline assembly feature that does not work with LLVM Clang
The SET_INTERRUPT_HANDLER macro in interrupt.h used an inline assembly
feature to cause GCC to generate a unique number for a trampoline
label.  Clang compiled the code using that feature without generating
any compile-time errors, but it always generated the number 0,
resulting in all interrupt trampolines having the same label names.
This patch replaces the usage of that feature with local labels, which
are supported by both GCC and Clang.  See
https://sourceware.org/binutils/docs/as/Symbol-Names.html for an
explanation of local labels.
2015-12-21 08:06:14 -02:00
Michael LeMay
f9072c166b x86: Add missing clobber list in interrupt.h
The SET_INTERRUPT_HANDLER macro defines and registers an interrupt
handler.  It outputs a trampoline for the interrupt handler using a
block of inline assembly, and the address of that trampoline is what
is actually placed in the IDT.  That trampoline invokes the main body
of the interrupt handler.

This patch adds a missing clobber list to the inline assembly block.
It simply lists the caller-saved registers defined by the cdecl
calling convention: EAX, ECX, and EDX.  This is necessary, because the
inline assembly block invokes idt_set_intr_gate_desc using a call
instruction at the time the function containing the
SET_INTERRUPT_HANDLER instance is executed.  The
idt_set_intr_gate_desc function is free to clobber EAX, ECX, and EDX
according to cdecl.  A Clang-generated implementation of
idt_set_intr_gate_desc did in fact clobber those registers, resulting
in incorrect operation of the code following an instance of
SET_INTERRUPT_HANDLER.  The change in this patch informs the compiler
that those registers may be clobbered so that it can adjust the code
that it outputs around the inline assembly block accordingly.
2015-12-21 08:06:14 -02:00
Jesus Sanchez-Palencia
bdcf58033a x86: Group sections for QuarkX1000
Child sections can be created depending on the CFLAGS used when building Contiki.
For instance, if built with -ffunction-sections or -fdata-sections would create
one section per function/variable and -Os sometimes split part of .text into one
child section.

This can also be an issue if we start linking with external libraries that are
built in such a way. Since we can't foresee how the port is going to be used,
we should make sure it is ready for the cases above.

This patch fixes this by correctly grouping child sections into their parent
sections.

Patch developed while investigating a bug with José Souza (jose.souza@intel.com).
2015-12-21 08:06:14 -02:00