Commit graph

1715 commits

Author SHA1 Message Date
Anas Nashif e4a963c5d1 tests: arm_irq_vector_table: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1a0875111c tests: alert_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c7cd5d260a tests: sleep: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 5a0842d5d2 tests: put tickless tests together
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif ffa850d86f tests: workq_api: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c31a11c591 tests: work_queue: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 520d3c0fbf tests: workq_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif f268b6acf2 tests: mem_heap: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 27f32b9d56 tests: mem_pool_threadsafe: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif b787eff65b tests: mem_pool_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 16cfaac754 tests: mem_pool: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 26c7ac1f4f tests: mslab_threadsafe: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a9da45a200 tests: mslab_concept: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif d744a2709e tests: mslab_api: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 9541ebc7a3 tests: rename test directory for mem_pool
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c51e80e3b7 tests: rename test directory for mem_slab
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1803009eb5 tests: rename test directory for fifo
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a9fe253422 tests: rename test directory for lifo
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a6292a1615 tests: rename test directory for alert
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 397d29db42 linker: move all linker headers to include/linker
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-18 09:24:04 -05:00
David B. Kinder ddbf1255a9 test: fix misspellings
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-17 22:34:45 -04:00
Anas Nashif 2d970a2cbd tests: rename test directory test_bluetooth -> bluetooth
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif ea1addbb3c tests: rename test directory test_loop_transfer -> loop_transfer
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif fcb1d175e6 tests: rename test directory test_chan_blen_transfer
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 2d1ac45f01 tests: rename test directory test_sha256 -> sha256
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 0772abff24 tests: rename test directory test_mbedtls -> mbedtls
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 38fca5cb5d tests: rename test directory test_hmac_prng -> hmac_prng
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif abaa5cb42f tests: rename test directory test_hmac -> hmac
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 4ce66b728f tests: rename test directory test_ecc_dh -> ecc_dh
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif dfe3195db8 tests: rename test directory test_ecc_dsa -> ecc_dsa
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif d8dfdceb65 tests: rename test directory test_ctr_prng -> ctr_prng
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 3c3aac9e44 tests: rename test directory test_ctr_mode -> ctr_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif e10e013082 tests: rename test directory test_cmac_mode -> cmac_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 99b8dc0534 tests: rename test directory test_ccm_mode -> ccm_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 2d1a4a1284 tests: rename test directory test_cbc_mode -> cbc_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif f18ef22824 tests: rename test directory test_aes -> aes
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Johan Hedberg 9703927f84 net: buf: Move net_buf_pool objects to dedicated linker area
Moving the net_buf_pool objects to a dedicated area lets us access
them by array offset into this area instead of directly by pointer.
This helps reduce the size of net_buf objects by 4 bytes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-06-16 17:05:06 +03:00
Jukka Rissanen 72567677e7 net: pkt: Fix net_pkt_split()
The net_pkt_split() was incorrectly checking fragA pointer
even before it was allocated.

The unit test is fixed and converted to ztest.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-16 17:05:06 +03:00
Jukka Rissanen 096a9984b2 tests: net: ipv6_fragment: Fix llvm compiler warning
llvm complains about char* -> u8_t* type conversion.

tests/net/ipv6_fragment/src/main.c:645:52: warning:
  passing 'char [11]' to parameter of type 'const u8_t *' (aka
  'const unsigned char *') converts between pointers to integer
  types with different sign [-Wpointer-sign]
        bool written = net_pkt_append_all(pkt, data_len, data,

Jira: ZEP-2274

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-16 16:07:08 +03:00
Adithya Baglody be1cb961ad tests: benchmark: boot_time: Reading time stamps made arch agnostic
1. Changed _tsc_read() to k_cycles_get_32(). Thus reading the
time stamp will be agnostic of the architecutre used.
2. Changed the variable names from *_tsc to *_time_stamp.

JIRA: ZEP-1426

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-06-16 07:37:37 -05:00
Kumar Gala 276794b0d7 tests: benchmarks: footprint: really enable floating point on arm
Update the arm.conf to enable CONFIG_FLOAT for the float test and use a
filter on that so we only run/build the test on SoCs/boards that support
floating point hardware.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Kumar Gala 2970ffff53 tests: benchmarks: footprint: build on ARM
Enable all footprint tests to build on ARM.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Kumar Gala 2f9478614a tests: benchmarks: footprint: fix tag typo
testcase.ini had a typo for footprint-float test.  tag was 'ootprint'
should have been 'footprint'.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Luiz Augusto von Dentz 79af35991b Bluetooth: GATT: Add bt_gatt_register_service
This adds bt_gatt_register_service using bt_gatt_service which contains
the attribute array that is then added to the database saving a pointer
in each and every attribute declared.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz d837a6ec4b Bluetooth: GATT: Add GAP service by default
GAP is mandatory service and now that the db can only be build
dynamically there is no reason to keep the applications registering it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz b3cfabab63 Bluetooth: Remove CONFIG_BLUETOOTH_GATT_DYNAMIC_DB
Removes CONFIG_BLUETOOTH_GATT_DYNAMIC_DB in preparation to the
introduction of bt_gatt_unregister.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Vinayak Kariappa Chettimada 51d6bdb2ff Bluetooth: controller: LE Advertising Extensions PDU structs
Add Bluetooth v5.0 LE Advertising Extensions air interface
packet structures.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-14 18:40:40 +03:00
Luiz Augusto von Dentz aac4f488be tests: Add shell tests
This adds the following tests:

help tests:
shell_exec(help): 0
shell_exec(help dummy): 0
shell_exec(help invalid): -22

select tests:
shell_exec(select): 0
shell_exec(select dummy): 0
shell_exec(select invalid): -22

module tests:
shell_exec(dummy cmd1): 0
shell_exec(dummy cmd1 arg1): -22
shell_exec(dummy cmd2 arg1): 0
shell_exec(dummy cmd2 arg1 arg2): -22
shell_exec(dummy cmd3 arg1 arg2): 0
shell_exec(dummy cmd3 arg1 arg2 arg3): -22
shell_exec(dummy cmd4 arg1 arg2 arg3): -22
shell_exec(cmd1): 0
shell_exec(cmd1 arg1): -22
shell_exec(cmd2 arg1): 0
shell_exec(cmd2 arg1 arg2): -22
shell_exec(cmd3 arg1 arg2): 0
shell_exec(cmd3 arg1 arg2 arg3): -22
shell_exec(cmd4 arg1 arg2 arg3): -22

app handler tests:
shell_exec(cmd4 arg1 arg2 arg3): 0

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-09 18:54:27 -04:00
Andrew Boie 15ed8ec7ea tests: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie bcb4cfe9e4 tests: net: use main thread for test
The main thread was doing nothing but spawning another thread to perform
the test. Delete the alternate thread, and just do the test on the main
thread, adjusting stack size and priority as necessary.

Issue: ZEP-2236
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie 0b9f9f3023 tests: context: move idle test to the end
On some devices, when k_cpu_idle() was called we were getting
interrupts that were not the timer interrupt. On bbc_micro
a power clock control driver interrupt was happening instead
and k_cpu_idle() was returning without the system tick advancing,
failing the test.

The clock control interrupts seem to only happen early in device
boot; moving the idle test much later lets the test pass on this
board (and likely all other NRF5 based boards).

Issue: ZEP-2257
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 15:12:03 -04:00
Marti Bolivar 2a29bed8bb tests: json: add tests for arrays of objects
Add tests for the newly-added JSON_OBJ_DESCR_OBJ_ARRAY. These pass.

Note that this also adds test coverage for decoding an array of
maximum length, to avoid regressing the recently-introduced fix for
this edge case.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-06-08 15:11:23 -04:00
Anas Nashif 6e78701392 tests: remove obsolete usage of defrag
Also increase ISR stack to make it run on Quark D2000 CRB.

Jira: ZEP-2224
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-08 14:53:49 -04:00
Andrew Boie 000429c069 tests: fatal: increase coverage
- _SysFatalErrorHandler is supposed to be user-overridable.
The test case now installs its own handler to show that this
has happened properly.

- Use TC_PRINT() TC_ERROR() macros

- Since we have out own _SysFatalErrorHandler, show that
k_panic() works

- Show that _SysFatalErrorHandler gets invoked with the expected
reason code for some of the scenarios.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 13:49:36 -05:00
Anas Nashif 3405607d9e license: add missing licenses and copyright
We were missing license boilerplate in many files, add them

Jira: ZEP-1464

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-08 10:41:56 -04:00
Andrew Boie 68e8813896 tests: context: allow 2 ticks of slop
The hard-coded value of 10ms doesn't take the system configured
amount of ticks per second, nor does it account for an unlucky
tick advance which causes the test to fail very intermittently
in QEMU.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 08:02:32 -04:00
Andrew Boie 7a5150cd9f tests: context: make some failures less ambiguous
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 08:02:32 -04:00
Ravi kumar Veeramally 7a01988c64 net: 6lo: Fix source address uncompression
When src and dst addresses are compressed based on context
information, uncompression method should verify CID bit,
SAC and DAC bits and context ID's. But it has missed some
cases which resulted in invalid uncompressed IPv6 header.

e.g. CID is set, SAC is 0 and DAC is 1 and context id's provided.
Uncompression method assumed that src address is compressed based
on context information but it is not.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-06-06 09:06:01 -04:00
Andrew Boie 7b7504e2b9 schedule_api: don't exclude Nios II
Nothing about this test requires tickless idle and it's not even
turned on in prj.conf.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-02 14:47:01 -04:00
Anas Nashif 70b2a57d7a quark_d2000_crb: increase default stack size
Increase to 1024 to get more tests and sample running on this device
with only 8K of SRAM.

Change thread stack size in the mslab test to make it fit into this
board.

Jira: ZEP-2079
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-01 10:27:34 -04:00
Marti Bolivar 7a7bc707d1 tests: json: test JSON_OBJ_DESCR_*_NAMED
Add tests for new macro helpers that allow JSON field names to differ
from their corresponding C struct field names. These pass.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-31 14:53:26 -04:00
Marti Bolivar a8e08ecdad tests: json: fix sense of test result string
The other test strings are worded in the positive sense; keep things
consistent.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-31 14:53:26 -04:00
Adithya Baglody bee2b8499b tests: benchmark: Fixed build error from icx toolchain.
The error was generated by a piece of code that is
not currently being used. This piece of code was kept to measure
the overhead caused by the benchmarking code on x86.

JIRA:ZEP-2160

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-31 12:51:42 -04:00
Andrew Boie 5963904e4c printk: fix printing of long long types
64-bit types were not being handled properly and depending on the
calling convention could result in garbage values being printed.

We still truncate these to 32-bit values, the predominant use-case
is printing timestamp delta values which generally fit in a 32-bit
value. However we are no longer printing random stuff.

Test case for printk() updated appripriately to catch this regression.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-30 19:42:22 -04:00
Jukka Rissanen 3f46248bb5 tests: net: ipv6: Test IPv6 fragmentation sending
These tests make sure that the IPv6 fragments are build correctly
when a large IPv6 packet is being sent.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-30 11:21:51 +03:00
Luiz Augusto von Dentz e1a062e28b Bluetooth: shell: Use CONFIG_BLUETOOTH_SHELL
Remove existing commands supported by CONFIG_BLUETOOTH_SHELL and make
sure all .conf select it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00
Sharron LIU 189aa475e1 tests: kernel: added tests for k_mem_pool_alloc from isr
Added tests to invoke k_mem_pool_alloc() from isr context

Jira: ZEP-1631

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-27 10:22:14 -04:00
Sharron LIU ab6d4c1a42 tests: kernel: added tests for timeslice reset
Added test cases to verify timeslice reset among thread context
switching.

Jira: ZEP-948

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-27 10:22:14 -04:00
Adithya Baglody c0549aae75 tests: benchmark: app_kernel: Return values from kernel APIs are read.
Static code analysis reported some kernel APIs were used without
reading the return value. Since the benchmark doesn't need error
conditions, a simple read of the values followed by a ARG_UNUSED
is used to handle static code analysis errors.

JIRA: ZEP-2134

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-27 10:20:14 -04:00
Leandro Pereira 90a2d2fcba tests: clock: Initialize d64 value
CID: 167149
Jira: ZEP-2130
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-05-27 09:54:31 -04:00
Johan Hedberg 9516d63836 Bluetooth: Remove support for NBLE
NBLE has been deprecated for a few releases now and can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-25 09:03:16 -07:00
Paul Sokolovsky cc47918166 tests: net: ipv6: Fix possible NULL pointer dereference behind a macro
As this is a test, it's minor issue, but let's keep Coverity report
clean.

Coverity-CID: 169303

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-25 18:54:22 +03:00
Jukka Rissanen 3677caa37e tests: net: zoap: Add path uri matching tests
Test the match_path_uri() function that was fixed by previous
commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-25 18:49:56 +03:00
Inaky Perez-Gonzalez 13617b943d tc: remove */defaults.tc
These files are no longer used and can be removed.

Change-Id: I781256ab93b5364346d99cd4aac488762c437151
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-05-22 20:17:02 -04:00
Justin Watson 44f09663f9 tests: kernel: Fixed tickless test for Arduino Due.
Arduino Due now uses ASF. The timestamps.c file was still
using old register definitions.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-20 13:25:32 -04:00
Andrew Boie b1b58dc5ce bluetooth: at: enable CONFIG_SERIAL
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-19 16:33:16 -04:00
Michael Scott 5ace805097 tests/zoap: fix net_pkt leak in test_observer_client()
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-05-19 09:59:07 +03:00
Anas Nashif e9a7fa7fd7 tests: net: increase RAM for test
This tests enables all networking features and requires lots of RAM, so
increase the available RAM to avoid failures due to not enough RAM when
building.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-18 22:23:31 -04:00
Youvedeep Singh ff5b3249f4 tests: aio: Change reference voltage for AIO
Change reference voltage for Analog comparator to Internal reference
voltage.

Currently AIO is using External reference voltage (Reference A) and
external reference is set at 3.3V. In this usecase both reference
Voltage and AIO IP are set at 3.3V. So rising edge interrupt behaviour
will be unpredictable.

So by changing internal reference voltage to Internal (set at 1.09V)
interrupt will be generated as soon as Voltage on I/P will exceed it.

Jira: ZEP-1927

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-18 20:26:56 -04:00
Qiu Peiyang b0962e3bac tests: aio: port AIO cases to run on more platforms
AIO should be supported on more platforms. Adapt
this case to make it run on more platforms.
Also keep reference voltage for comprator as internal.

Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-05-18 20:26:56 -04:00
Maciek Borzecki fed96bf1bc misc: _char_out can be a static symbol
Fixes sparse warning:
<snip>/zephyr/zephyr/misc/printk.c:50:5: warning: symbol '_char_out' was not declared. Should it be static?

Change-Id: I5af0860e9f8f827002ae9a142b5924d3de8d51b6
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2017-05-18 12:41:56 -05:00
Jukka Rissanen 69b25c0788 net: conn: Check UDP and TCP checksum before accepting packet
We did not check UDP or TCP checksum to be valid after receiving
the packet. Fix this so that the checksum is validated when
packet is received in connection handler. As the checksum validation
can be resource intensive, do it after we have verified that
there is a connection handler for this connection.

The checksum calculation can be turned OFF if needed, but it is
ON by default.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-18 10:53:39 +03:00
Andrew Boie 2596daa4ae tests: fifo: extend cancel timeout limit
A non-tickless system with 10ms granularity was occasionally
taking up to 70ms for the cancellation to be propagated back.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-17 12:04:10 -04:00
Anas Nashif 876334c699 tests: net: reduce timeout of testcase
Use a reasonable timeout for the testcase.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-17 16:35:26 +03:00
Vinayak Kariappa Chettimada a7afc75c8a Bluetooth: shell: Add GATT write cmd throughput measurement
Add shell command to test GATT write cmd throughput between
two test shell peers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-16 15:30:51 +03:00
Luiz Augusto von Dentz 4f019eab26 Bluetooth: shell: Remove forward declaration
It is possible to remove the forward declaration of l2cap_alloc_buf as
the recv pointer can be compared directly with chan pointer avoiding
using l2cap_ops directly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-14 17:54:46 +03:00
Vinayak Kariappa Chettimada 9fd04ea272 Bluetooth: shell: Add L2CAP throughput measurement
Added l2cap-metrics command to shell application which will
collect the rx-ed L2CAP CoC throughput.

Usage (local shell):
> l2cap-register <chan>
> l2cap-metrics on

  From peer shell:
  > l2cap-connect <chan>
  > l2cap-send 10

> l2cap-metrics
l2cap rate: 119225 bps.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-14 11:19:27 +03:00
Andrew Boie 636f609d66 tests: kernel: fatal: check stack overflow
For all arches except ARC, enable stack sentinel and test that
some common stack violations trigger exceptions.

For ARC, use the hardware stack checking feature.

Additional testcase.ini blocks may be added to do stack bounds checking
for MMU/MPU-based stack protection schemes.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-13 15:14:41 -04:00
Andy Ross 73cb9586ce k_mem_pool: Complete rework
This patch amounts to a mostly complete rewrite of the k_mem_pool
allocator, which had been the source of historical complaints vs. the
one easily available in newlib.  The basic design of the allocator is
unchanged (it's still a 4-way buddy allocator), but the implementation
has made different choices throughout.  Major changes:

Space efficiency: The old implementation required ~2.66 bytes per
"smallest block" in overhead, plus 16 bytes per log4 "level" of the
allocation tree, plus a global tracking struct of 32 bytes and a very
surprising 12 byte overhead (in struct k_mem_block) per active
allocation on top of the returned data pointer.  This new allocator
uses a simple bit array as the only per-block storage and places the
free list into the freed blocks themselves, requiring only ~1.33 bits
per smallest block, 12 bytes per level, 32 byte globally and only 4
bytes of per-allocation bookeeping.  And it puts more of the generated
tree into BSS, slightly reducing binary sizes for non-trivial pool
sizes (even as the code size itself has increased a tiny bit).

IRQ safe: atomic operations on the store have been cut down to be at
most "4 bit sets and dlist operations" (i.e. a few dozen
instructions), reducing latency significantly and allowing us to lock
against interrupts cleanly from all APIs.  Allocations and frees can
be done from ISRs now without limitation (well, obviously you can't
sleep, so "timeout" must be K_NO_WAIT).

Deterministic performance: there is no more "defragmentation" step
that must be manually managed.  Block coalescing is done synchronously
at free time and takes constant time (strictly log4(num_levels)), as
the detection of four free "partner bits" is just a simple shift and
mask operation.

Cleaner behavior with odd sizes.  The old code assumed that the
specified maximum size would be a power of four multiple of the
minimum size, making use of non-standard buffer sizes problematic.
This implementation re-aligns the sub-blocks at each level and can
handle situations wehre alignment restrictions mean fewer than 4x will
be available.  If you want precise layout control, you can still
specify the sizes rigorously.  It just doesn't break if you don't.

More portable: the original implementation made use of GNU assembler
macros embedded inline within C __asm__ statements.  Not all
toolchains are actually backed by a GNU assembler even when the
support the GNU assembly syntax.  This is pure C, albeit with some
hairy macros to expand the compile-time-computed values.

Related changes that had to be rolled into this patch for bisectability:

* The new allocator has a firm minimum block size of 8 bytes (to store
  the dlist_node_t).  It will "work" with smaller requested min_size
  values, but obviously makes no firm promises about layout or how
  many will be available.  Unfortunately many of the tests were
  written with very small 4-byte minimum sizes and to assume exactly
  how many they could allocate.  Bump the sizes to match the allocator
  minimum.

* The mbox and pipes API made use of the internals of k_mem_block and
  had to be ported to the new scheme.  Blocks no longer store a
  backpointer to the pool that allocated them (it's an integer ID in a
  bitfield) , so if you want to "nullify" them you have to use the
  data pointer.

* test_mbox_api had a bug were it was prematurely freeing k_mem_blocks
  that it sent through the mailbox.  This worked in the old allocator
  because the memory wouldn't be touched when freed, but now we stuff
  list pointers in there and the bug was exposed.

* Remove test_mpool_options: the options (related to defragmentation
  behavior) tested no longer exist.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-05-13 14:39:41 -04:00
Vinayak Kariappa Chettimada 5effd68a9d Bluetooth: controller: Fix tests conf file to cover new features
Updated tests conf file with coverage for new feature Kconfig
options in the Controller. This is required to catch compile/
build regression.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-12 13:55:39 +03:00
Andrew Boie 68d3678abb tests: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie 86468fc9a5 tests: kernel: common: adjust stack size
Use Kconfig for extra test case stack size, needed for Xtensa.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 12:47:23 -04:00
Paul Sokolovsky 2ddd620617 tests: kernel: errno: Add Newlib test config.
Added because previously, Zephyr used API incompatible with Newlib
for errno handling. Even with Newlib compatibility changes, we
override the function which is defined in Zephyr SDK libc.a, so
makes sense to ensure thsi works as expected.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-10 20:54:56 -04:00
Andrew Boie b1dd5ea50d tests: kernel: fatal: fix on ARC
Issue: ZEP-2114
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-10 20:13:07 -04:00
Paul Sokolovsky 3f50707672 kernel: queue, fifo: Add cancel_wait operation.
Currently, a queue/fifo getter chooses how long to wait for an
element. But there are scenarios when putter would know better,
there should be a way to expire getter's timeout to make it run
again. k_queue_cancel_wait() and k_fifo_cancel_wait() functions
do just that. They cause corresponding *_get() functions to return
with NULL value, as if timeout expired on getter's side (even
K_FOREVER).

This can be used to signal out of band conditions from putter to
getter, e.g. end of processing, error, configuration change, etc.
A specific event would be communicated to getter by other means
(e.g. using existing shared context structures).

Without this call, achieving the same effect would require e.g.
calling k_fifo_put() with a pointer to a special sentinal memory
structure - such structure would need to be allocated somewhere
and somehow, and getter would need to recognize it from a normal
data item. Having cancel_wait() functions offers an elegant
alternative. From this perspective, these calls can be seen as
an equivalent to e.g. k_fifo_put(fifo, NULL), except that such
call won't work in practice.

Change-Id: I47b7f690dc325a80943082bcf5345c41649e7024
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-10 09:40:33 -04:00
Sharron LIU 6c6182dba5 tests:kernel: added tests for printk left justifier
Added test case for printk the '-' indicator in format string
(left justifier).

Jira: ZEP-1599

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-08 09:43:37 -04:00
Marti Bolivar 88f33dcc1b tests: json: add json_escape() tests
These all pass.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-08 08:52:52 -04:00
Vinayak Chettimada fc6d8d1bc4 Bluetooth: controller: Scan Request Notifications
Implement the framework for LE Scan Request Received Event.
The feature is available under the Controller's advanced
features and will be selected implcitly when Bluetooth v5.0
LE Advertising Extensions feature is implemented.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-05 15:56:04 +03:00
Carles Cufi a1ff1a0933 Bluetooth: Consolidate flow control Kconfig
Since Controller to Host flow control is a feature that affects both
sides equally, move it to the top-level Kconfig file and consolidate its
use in both Controller and Host.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-04 18:09:31 +03:00
Luiz Augusto von Dentz ad4bb37b17 Bluetooth: shell: Fix deadlock when receiving L2CAP packet
The TX and RX pool needs to be split otherwise the TX code path may
consume all buffers causing the RX thread to deadlock which will
possible deadlock the TX thread as well in case it needs more credits.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-04 08:36:12 +03:00
Carles Cufi 7ebe7da736 Bluetooth: controller: Controller to Host flow control
The Bluetooth Specification allows for optional Controller to Host flow
control based on the same credit-based mechanism as the Host to
Controller one. This is particularly useful in 2-chip solutions where
the Host and the Controller are connected via a physical link (UART, SPI
or similar) where the Host is sometimes required to ask the Controller
to throttle its data traffic while still making sure that relevant
events get through the line.

This implementation is based on a simple queue of pending events and
data that is populated whenever the Controller detects that the Host is
out of buffers and then emptied whenever the Host notifies the
Controller that is ready to receive data again. Events relevant to the
connections are also queued to preserve the order of arrival.

At this point the Controller ignores the connection handle sent by the
Host and treats all connections equally, and it also queues events even
for connections that have no data pending in the queue. Both this items
can be improved if necessity arises.

Note that Number of Completed Packets will still flow freely from the
Controller to the Host regardless of the pending ACL data packets, which
might lead to inconsistencies in the sequential order of certain
operations that include bi-directional data transfer.

Jira: ZEP-1735

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-03 22:23:42 +03:00
Marti Bolivar 7e7a045fa9 tests: json: use JSON_OBJ_DESCR_PRIM
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-03 13:52:57 -04:00
Justin Watson 558281b096 arch: sam3x: update Kconfig options after move to SAM SoC family tree
The files for the Arduino Due needed to be updated to use the new
configuration when the SoC moved from the atmel_sam3 directory to
the atmel_sam/sam3x directory.

Jira: ZEP-2067

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-03 13:51:37 -04:00
Adithya Baglody d03b2496cd test: benchmarking: Timing metrics for the kernel
JIRA: ZEP-1822, ZEP-1823, ZEP-1825

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-03 08:46:30 -04:00
Rishi Khare f6f8fb0f47 kernel tests: fatal: added "ignore_faults" tag
This test generates a fault as part of the test,hence make the
 test-suite aware of that by tagging it.

Signed-off-by: Rishi Khare <rishi.khare@intel.com>
2017-05-03 08:16:38 -04:00
Paul Sokolovsky b7f6aaaa72 tests: uart_basic_api: Don't assume we can drink from IRQ firehose.
There're (at least) 2 UART TX interrupt causes: "tx fifo has more
room" and "transmission of tx fifo complete". Zephyr API has only
one function to enable TX interrupts, uart_irq_tx_enable(), so it's
fair to assume it enables interrupt for both conditions. But then
immediately after enabling TX IRQ, it will be fired with "tx fifo
has more room" cause. If ISR doesn't do anything to fill FIFO, on
some architectures, immediately after return from ISR, it will be
fired again (with no instruction progress in the main application
thread). That's exactly the situation with this test, and on ARM,
it leads to inifnite IRQ loop.

So, instead move call to uart_fifo_fill() inside ISR, and be sure
to disable TX IRQ after we transmitted enough characters.

Change-Id: Ibbd05acf96b01fdb128f08054819fd104d6dfae8
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-02 09:31:36 -04:00
Anas Nashif 1084bd5ed3 tests: crypto: reduce high timeout value
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-01 09:37:34 -04:00
Anas Nashif e40bd685f6 tests: net: set reasonable timeout on dns test
This test has been slowing daily tests for no good reason, timeout of
10800 is way too high.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-01 09:37:34 -04:00
Luiz Augusto von Dentz a03e068b03 Bluetooth: shell: Don't attempt to reuse channel
If the channel is already in use don't attempt to connect it a second
time.

Change-Id: I87bdaeadbe866b59c1a7975002699d9ef7a90c61
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-29 11:39:13 -04:00
Gil Pitney 70040f0e11 boards: Add support for the CC3220SF_LAUNCHXL board
CC3220SF_LAUNCHXL effectively replaces the CC3200_LAUNCHXL,
with support for the CC3220SF SoC, which is an update for
the CC3200 SoC.

This is supported by the Texas Instruments CC3220 SDK.

Jira: ZEP-1958

Change-Id: I2484d3ee87b7f909c783597d95128f2b45db36f2
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-28 15:06:41 -05:00
Paul Sokolovsky 25307d5331 net: net_pkt_append: Refactor to return length of data actually added
For stream-based protocols (TCP), adding less data than requested
("short write") is generally not a problem - the rest of data can
be sent in the next packet. So, make net_pkt_append() return length
of written data instead of just bool flag, which makes it closer
to the behavior of POSIX send()/write() calls.

There're many users of older net_pkt_append() in the codebase
however, so net_pkt_append_all() convenience function is added which
keeps returning a boolean flag. All current users were converted to
this function, except for two:

samples/net/http_server/src/ssl_utils.c
samples/net/mbedtls_sslclient/src/tcp.c

Both are related to TLS and implement mbedTLS "tx callback", which
follows POSIX short-write semantics. Both cases also had a code to
workaround previous boolean-only behavior of net_pkt_append() - after
calling it, they measured length of the actual data added (but only
in case of successful return of net_pkt_append(), so that didn't
really help). So, these 2 cases are already improved.

Jira: ZEP-1984

Change-Id: Ibaf7c029b15e91b516d73dab3612eed190ee982b
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:09 +03:00
Ramesh Thomas c759ed1f94 samples: power: Time is passed as milliseconds in tickless kernel
In tickless kernel mode, time parameter of _sys_soc_suspend is in
milliseconds. Based on the kernel mode use the correct
mulitplier to convert to seconds.

Jira:1821
Change-Id: Idf156f56ece79a82729ebb124d1552a5eeb69e25
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:35 +00:00
Ramesh Thomas 700712f869 samples: tickless: Enables tickless kernel option in some apps
Adds changes to enable existing kernel and timer tests and samples to
be used to test the tickless kernel feature.

Updated samples/philosophers and tests/kernel/timer/timer_api apps

Run the tests using following commands
make pristine && make BOARD=<board> CONF_FILE=prj_tickless.conf qemu
Board could be any of the following
qemu_x86
quark_se_c1000_devboard

Jira: ZEP-339 ZEP-1812
Change-Id: I1530b19b79ddeb0e2181594caf15f3ac28ff51f4
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:33 +00:00
Andrew Boie 73abd32a7d kernel: expose struct k_thread implementation
Historically, space for struct k_thread was always carved out of the
thread's stack region. However, we want more control on where this data
will reside; in memory protection scenarios the stack may only be used
for actual stack data and nothing else.

On some platforms (particularly ARM), including kernel_arch_data.h from
the toplevel kernel.h exposes intractable circular dependency issues.
We create a new per-arch header "kernel_arch_thread.h" with very limited
scope; it only defines the three data structures necessary to instantiate
the arch-specific bits of a struct k_thread.

Change-Id: I3a55b4ed4270512e58cf671f327bb033ad7f4a4f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-26 16:29:06 +00:00
Andrew Boie ca441162a7 tests: add fatal test case
We want to show that if a non-essential thread gets a fatal exception,
that thread gets aborted but the rest of the system works properly.

We also test that k_oops() does the same.

Issue: ZEP-2052
Change-Id: I0f88bcae865bf12bb91bb55e50e8ac9721672434
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Andrew Boie 7827b7bf4a x86: exception-assisted panic/oops support
We reserve a specific vector in the IDT to trigger when we want to
enter a fatal exception state from software.

Disabled for drivers/build_all tests as we were up to the ROM limit
on Quark D2000.

Issue: ZEP-843
Change-Id: I4de7f025fba0691d07bcc3b3f0925973834496a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Kumar Gala eaaa175b92 tests: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I6c676bc6c5e850a8725785554cd535e32067f33e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:49 -05:00
Kumar Gala a509441210 net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:30:38 -05:00
Jukka Rissanen f498a90b77 net: pkt: Make the debug print eye friendly
Print "pkt" instead of "Pkt" when printing network packet
pointer value.

Change-Id: Id4225be9c55807def3d892d372cdfc5c79c871fc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka f3ff4f7bd3 net_pkt: Let's make all IPv6 related attributes prefixed with ipv6_
Only 2 attributes lacked this prefix, which makes sense to have, so
applying it accordingly and changing the helpers as well.

Change-Id: I095b2729f977f8fb1624eff8801a4a4e21416693
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka e5896906f6 net: Rename all *_BUF() macros to *_HDR()
Most of these macros are not exactly exposing a buffer, but a specific
header pointer (ipv6, ivp4, ethernet and so on), so it relevant to
rename them accordingly.

Change-Id: I66e32f7c3f2bc75994befb28d823e24299a53f5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Kumar Gala 3c454017b4 Merge "Merge bluetooth branch into master" 2017-04-20 16:55:36 +00:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
Johan Hedberg c52fa3c424 Merge bluetooth branch into master
- newlib related fixes for the AT parser
 - Channel Selection Algorithm #2 support (Bluetooth 5.0 feature)
 - Better tracking of outgoing data (with callback support)
 - Various smaller cleanups & fixes

----------------------------------------------------------------
Carles Cufi (3):
      Bluetooth: HCI: Add Bluetooth 5.0 LE commands and events
      Bluetooth: HCI: Naming consistency tweaks
      Bluetooth: Use event masks instead of bits in controller and host

Johan Hedberg (8):
      Bluetooth: hci_raw: Fix ECC support
      Bluetooth: Add support for tracking transmitted packets
      Bluetooth: ATT: Enforce flow for incoming requests & indications
      Bluetooth: SMP: Track when last key distribution PDU has been sent
      Bluetooth: Introduce a timeout for synchronous HCI command sending
      Bluetooth: ATT: Fix bogus CONTAINER_OF() usage
      Bluetooth: Introduce flow control for outgoing ATT packets
      Bluetooth: ATT: Start response timer only after actual transmission

Kumar Gala (3):
      Bluetooth: AT: use explicit unsigned char to avoid array subscript error
      Bluetooth: AT: Fix building with newlib
      Bluetooth: AT: Unit: Fixup include search path

Luiz Augusto von Dentz (4):
      Bluetooth: ipsp: Add TX pools for TCP
      Bluetooth: L2CAP: Try to allocate segment from the original pool
      net: buf: Add net_buf_reset
      Bluetooth: L2CAP: Reuse request buffer to respond

Vinayak Chettimada (5):
      Bluetooth: controller: Rename channel/chnl to chan
      Bluetooth: HCI: Add Bluetooth 5.0 FeatureSet field's bit mapping
      Bluetooth: Fix missing LE conn param req bit in set LE evt mask
      Bluetooth: controller: Support BT 5.0 feature set bit fields
      Bluetooth: controller: Channel Selection Algorithm #2

 include/bluetooth/hci.h                           | 495 +++++++++++++++--
 include/bluetooth/l2cap.h                         |   2 +-
 include/net/buf.h                                 |   9 +
 samples/bluetooth/ipsp/src/main.c                 |  15 +
 subsys/bluetooth/controller/Kconfig               |   7 +
 subsys/bluetooth/controller/hal/nrf5/radio.c      |   4 +-
 subsys/bluetooth/controller/hal/radio.h           |   2 +-
 subsys/bluetooth/controller/hci/hci.c             |  95 ++--
 subsys/bluetooth/controller/ll_sw/ctrl.c          | 622 ++++++++++++++++------
 subsys/bluetooth/controller/ll_sw/ctrl.h          |  71 ++-
 subsys/bluetooth/controller/ll_sw/ctrl_internal.h |  25 +-
 subsys/bluetooth/controller/ll_sw/ll.c            |  24 +-
 subsys/bluetooth/controller/ll_sw/pdu.h           |  12 +-
 subsys/bluetooth/host/Kconfig                     |  31 ++
 subsys/bluetooth/host/at.c                        |   2 +-
 subsys/bluetooth/host/at.h                        |   2 +-
 subsys/bluetooth/host/att.c                       | 230 ++++++--
 subsys/bluetooth/host/conn.c                      | 111 +++-
 subsys/bluetooth/host/conn_internal.h             |  23 +-
 subsys/bluetooth/host/hci_core.c                  | 163 +++---
 subsys/bluetooth/host/hci_core.h                  |   3 +-
 subsys/bluetooth/host/hci_ecc.c                   |   2 +-
 subsys/bluetooth/host/hci_raw.c                   |   4 +
 subsys/bluetooth/host/hfp_hf.c                    |   2 +
 subsys/bluetooth/host/l2cap.c                     |  79 ++-
 subsys/bluetooth/host/l2cap_internal.h            |  12 +-
 subsys/bluetooth/host/sdp.c                       |   2 +
 subsys/bluetooth/host/smp.c                       | 117 +++-
 subsys/net/buf.c                                  |  12 +-
 tests/bluetooth/init/prj_controller_4_0.conf      |   1 +
 tests/unit/bluetooth/at/src/Makefile              |   2 +-
 tests/unit/bluetooth/at/src/main.c                |   2 +-
 32 files changed, 1695 insertions(+), 488 deletions(-)

Change-Id: I17f9e49e1347a38bc78be3bdcaa596e41d83da56
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-20 18:45:15 +03:00
Anas Nashif 0b1d41d31d kernel: remove mentions of obsolete CONFIG_NANO_TIMERS
Change-Id: I0a2d6caae6d37b45968e61be8eaf7c4ebb6fdc46
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-20 12:27:36 +00:00
Vinayak Chettimada 392b5deacb Bluetooth: controller: Channel Selection Algorithm #2
Add Bluetooth 5.0 LE Channel Selection Algorithm #2 feature

Jira: ZEP-2033

Change-id: Ic1155b4399882b89cab33cac78b08b7b39ff6f9d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-20 08:58:09 +03:00
Kumar Gala a87e6e1cce Bluetooth: AT: Unit: Fixup include search path
Because of the way we build we can't expect relative paths back into the
Zephyr code base to work properlly.  This just happens to work on some
systems because of the various -I that exist and one hits the right
number of subdirs between it and where the "at.h" lives.  Lets instead
add the Zephyr root as a include path and explicit do a relative path
from the root to get the header.

We end up with a build failure with newlib enabled on galileo because it
ends up not having an include path that gets us to the proper spot with
the various ../../.. ...

Change-Id: I48b4dc2dffb76314f380efbcbbe25957ff5e9e07
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 08:58:09 +03:00
Anas Nashif 45a7e5d076 kernel: remove legacy.h and MDEF support
Change-Id: I953797f6965354c5b599f4ad91d63901401d2632
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 10:59:35 -05:00
Anas Nashif 306e15e0a1 kernel: remove legacy kernel support
Change-Id: Iac1e21677d74f81a93cd29d64cce261676ae78a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 15:48:37 +00:00
Andrew Boie 2d9a559df8 tests: crypto: enable on other arches
Some tests have large RAM requirements, appropriate filters added.
Redundant 'build_only = false' removed.

Issue: ZEP-1721
Change-Id: Id8b06b2ea8a63cf19cf155a75f1513810c383521
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-18 20:51:39 +00:00
Youvedeep Singh 76fc2f92df test_tickless: Change test_tickless location to tests/kernel/test_tickless/
Tickless test dependency on legacy API is resolved, Changing
test directory from tests/legacy/kernel/test_tickless to
tests/kernel/test_tickless/.

Jira: ZEP-2008

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Change-Id: I0b53ae6eff3a915d988d3234592eb5f8b425b371
2017-04-18 22:25:01 +05:30
Youvedeep Singh 576cfd9e74 test_tickless: replacing depreciated APIs with new one.
As part of Zephyr release 1.9 some APIs will be depreciated. This patch
replaces two of such APIs (task_sleep(ticks), sys_tick_get_32()) with
new ones (k_sleep(ms), k_uptime_get_32()).

Jira: ZEP-2008

Change-Id: Ic0e05906dadfb2ddaea9d0a8b738294dc81430f9
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 22:08:19 +05:30
Youvedeep Singh 9031c55566 test_sleep: move test_sleep from tests/legacy/kernel to tests/kernel
As test_sleep does not have dependency over legacy APIs.
So moving files from tests/legacy/kernel to tests/kernel.

Jira: ZEP-2009

Change-Id: I2439391ba6d0a194d07a0d1b48911d37b2f493b0
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 09:39:15 +05:30
Youvedeep Singh d353800879 test_sleep: replacing depreciated APIs with new one.
As part of Zephyr Release 1.9 some APIs will be depreciated.
This patch replaces APIs related to semophore init, kernel sleep,
task spawn etc.

Jira: ZEP-2009

Change-Id: I1fe09e9592f503c3413d51857fd740703173c042
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 09:26:58 +05:30
Sharron LIU eea12f6f14 tests: kernel: add tickless test
Added test cases to verify tickless idle concepts defined in
https://www.zephyrproject.org/doc/subsystems/power_management.html#tickless-idle

Test points:
verify system clock recovery after exiting tickless idle;
verify slicing scheduler behaves as expected

Jira: ZEP-339

Change-Id: Ic0a86d725e9692aa217375cedc7396372a026a88
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-04-18 01:50:47 +00:00
Kumar Gala 7fb0e36060 tests: sprintf: cleanup to work with newlib
newlib doesn't implement the internal buffer the same way that minimal
libc does, so only run that check with min libc (ie !CONFIG_NEWLIB_LIBC).
Also, reported the length we did get if the buffer is to big.  Finally
include <stdarg.h> since we are dealing with va_lists and such.

Change-Id: I6b23e448e5785df978ac8c2757099e2b8aaace54
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-18 00:27:33 +00:00
Kumar Gala ab8a3b2c0d tests: app_kernel: limit to systems with >32K of memory
We need a bit over 32k of memory to build/run the app_kernel benchmarks.

Change-Id: Iddfeb073f8ea87dc6323775a288b83efa88fdaea
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 16:12:57 -05:00
Anas Nashif 4c80a2fb71 tests: crypto: disable 2 tests that are ridiculously slow
Change-Id: I54194c06a1f3dfe1412dbfff50e9866134cf881a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Anas Nashif e8abb973e1 tests: app_kernel: enable ARM for this benchmark
Change-Id: I7d45bd5e84f174a951170c7b4ab464110976a00f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Anas Nashif e521d6e888 tests: remove legacy tag from ported tests
Change-Id: I77484a704062013577417e7d05ad65cf268d74b2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Kumar Gala 4ada031fb5 unit: Fixup crc unit test for zassert change
We renamed ztest's assert to zassert and the crc test case wasn't
updated to match so it doesn't build.

Change-Id: I67cd5bb6eef0875f31b8825d5c3aa5e1fa46af04
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 06:08:27 -05:00
Anas Nashif 0ac3a231f1 tests: rename ztests' assert > zassert
Change-Id: Ibccc5da75ad42bc035052e5946f977a49f6a7d2f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 00:07:06 -04:00
Anas Nashif d3af7f75c9 Merge "Merge net branch into master" 2017-04-14 01:43:34 +00:00
Kumar Gala c7bc909914 tests/ztest: rename assert macros to be zephyr specific
ztest has a number of assert style macros and used a baseline assert()
that varies from the system definition of assert() so lets rename
everything as zassert to be clear.

Change-Id: I7f176b3bae94d1045054d665be8b5bda947e5bb0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-13 21:17:33 +00:00
Andrew Boie b53145c6bc ztest: apply extra stack size to ztest stack
The directive exists for platforms that require more stack space than
usual. However, it wasn't being applied to the ztest thread stack
which ztest-enabled cases are run on.

Fixes numerous failures on xtensa simulator targets.

Change-Id: Iafa84de002421f03729c0f0cdeefdea51842ae32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 12:45:36 -07:00
Andrew Boie a883722fb6 tests: test_pipe_api: increase stack size
A recent patch added some new tests here. Unfortunately,
the current stack size value of 512 was too small for Xtensa.
Increase it to 1024.

Change-Id: I16c52b74412cbd7665e774ce3baed260885ddb9b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 18:58:51 +00:00
Andrew Boie d75fa6bc13 tests: sprintf: increase stack size
A recent patch pinned the stack size for this test at 1024
instead of the platform default. This value wasn't sufficient
on Xtensa. Set to 2048, which was the default on most platforms.

Change-Id: I9a9d5fd448d2377aaf782c2c093a16147f31886a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 18:58:24 +00:00
Jukka Rissanen bed1117423 net: tests: Enables all net kconfig options in one test case
This creates a test case that enables all the currently known
network related Kconfig options. This is useful so that we can
compile test various Kconfig options. Note that the result binary
is not meant to be run anywhere and it will probably not run as
some of the enabled options do not make sense in real life.

Change-Id: Iede36131b43d95acb78b4094004626e1b86e0f95
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:44 +03:00
Tomasz Bursztyka 000539ecd2 tests/net: arp_input() unref the buffer on success
Since commit-id 1ab40390c9 arp_input()
unrefs the buffer on success (NET_OK) so no need to do it afterward.

Change-Id: I84ab7e8eb07f50d52b329e4c025d88753a5de4db
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-13 15:21:43 +03:00
Tomasz Bursztyka 19a321090c tests/net: MQTT tests should be under lib
moving tests/net/mqtt_* tests under tests/net/lib/

Change-Id: I966a6b303ad4d0fb467f277a4a7379b29fe40e98
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-13 15:21:43 +03:00
Jukka Rissanen 31d3406efa net: rpl: Fix the statistics collection
The Kconfig.rpl file was missing option to actually collect
RPL statistics. Unified the config option name to be
CONFIG_NET_STATISTICS_RPL as there was two conflicting settings
in the code and both of them were missing from Kconfig file.

Change-Id: I4ce4fcbaa317b36cac315ea3b3f710fa7a344b25
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:42 +03:00
Wu Jiequan 0e3d582623 tests: net: Add mqtt testcases
Add two testcases for mqtt_publisher and mqtt_subscriber.
The combination of the two, covering most of the MQTT APIs.

Change-Id: Ib663ee1f550362ca493501046ddf8508a25ac956
Signed-off-by: Wu Jiequan <jiequanx.wu@intel.com>
2017-04-13 15:21:42 +03:00
Patrik Flykt 3f8f1ed3b0 unit: Create ztest unit test for CRC16 functionality
Ensure that the CRC16 functions compute a few test values properly.

Change-Id: Ie98049aefac8a330b9b81d3bf333deb09bc35c39
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2017-04-13 15:21:42 +03:00
Jukka Rissanen 1b2c16a498 net: nbuf: Add function to split a data fragment
Add net_nbuf_split() function that can be used to split
an existing net_buf fragment into two arbitrary length pieces,
and return the two new fragments to the caller. The data from
the original fragment is copied into these two new fragments.

Existing fragment is not modified.

Change-Id: I463e675232c6e19c2a42929f480893a6d1265873
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:41 +03:00
Jukka Rissanen f8c3467bde tests: net: tcp: Fix NULL pointer dereference
Incorrectly use variable even if it is null.

Coverity-CID: 157593

Change-Id: I883421a16870e5fe3c1d81e461f55f912ea168c0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:41 +03:00
Milosz Wasilewski deea71b3c6 tests: added TC_START to tests
TC_START was missing from some tests. For this reason automated testing
parsing wasn't unified for all tests. This patch fixes the issue and adds
TC_START to tests where it was missing.

Change-Id: I7e27a3fd8eaef9c3d0b0e0aeba9bca5b97eb0c58
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
2017-04-13 12:08:14 +00:00
Anas Nashif 6c77313a28 tests: benchmarks: increase timeout for app_kernel tests
This test takes a bit longe than specified and fails on a daily basis
due to the low timeout specified.

Change-Id: Id774c35cb1b0d0dcc5455e4121a8e9e1612baafd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-12 22:43:26 +00:00
Andrew Boie a313353344 xtensa: re-enable tinycrypt test cases
Tinycrypt 0.2.6 fixed the issue with the definition of 'bool'.

Issue: ZEP-1722
Change-Id: Ie470e25dfe02a58d9c3f2324cab85bc02f574b51
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-12 16:32:29 +00:00
ethan gao 8e22350651 tests: add AES cmac test to mbedtls test
it covers the story "Port AES-CMAC-PRF-128 [RFC 4615]
encryption library for Thread support"

ZEP-734

Change-Id: I6213309b51da435060c3e3cfadde67e21a927b2b
Signed-off-by: ethan gao <ethan.gao@intel.com>
2017-04-12 05:49:11 +00:00
Adithya Baglody abfbcc9318 tests: benchmarks: move app_kernel to unified kernel.
Deleted the instance of app_kernel in tests/legacy/benchmark.

JIRA: ZEP-1980
Change-Id: I5a6e073d9b0c870be0cc7d8ae5bb352b11d7f97e
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-04-11 21:07:01 -04:00
Anas Nashif bf382a59e0 tests: sprintf: increased main stack
This was failing when run on Quark D2000 CRB

Change-Id: I2d85fca15d1a89ad83fcb61a14a70ad94b5df373
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 16:41:06 -04:00
Anas Nashif b84dc2e124 kernel: remove all remaining references to nanokernel
Change-Id: I43067508898bc092879f7fe9d656ccca6fd92ab2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 20:21:10 +00:00
Anas Nashif d7bc60f096 kernel: remove remaining microkernel references
Change-Id: Ie648dbaaf714316c21395bd43e555618013dbd19
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 20:21:05 +00:00
Johan Hedberg 2ed8d83d4d Merge bluetooth branch into master
Controller:
	- Added duplicate filtering support
	- Added event mask support
	- Kconfig enhancements
	- Various cleanups

 Host:
	- IRQ locking fix to monitor protocol
	- Fixed potential deadlock in ECDH support
	- Fix to connection error reporting
	- Fix to GATT signing
	- Fix to LE CoC
	- AT command & HFP improvements

----------------------------------------------------------------
Carles Cufi (4):
      Bluetooth: controller: Implement scan duplicate filter
      Bluetooth: controller: Implement event masks
      Bluetooth: controller: Fix warning with no dup filter
      Bluetooth: test: Add "tiny" controller configuration

Johan Hedberg (11):
      Bluetooth: monitor: Drop data instead of holding IRQ lock for long
      Bluetooth: monitor: Add support for logging packet drops
      Bluetooth: HCI: Add define for success status
      Bluetooth: ECC: Fix command status emission from wrong thread
      Bluetooth: Controller: Introduce rate-limiting on stack analysis
      Bluetooth: Remove unnecessary controller-side buffers tracking
      Bluetooth: SMP: Remove redundant ';'
      Bluetooth: hci_ecc: Fix ECDH API usage
      Bluetooth: tests/shell: Limit BR/EDR configuration to Qemu for now
      Bluetooth: conn: Pass disconnect error properly to the conn struct
      Bluetooth: conn: Set initial responder address when connecting

Luiz Augusto von Dentz (4):
      Bluetooth: GATT: Fix using write command when signing was requested
      Bluetooth: GATT: Be consistent with error in case SMP is disabled
      Bluetooth: L2CAP: Fix accounting SDU header len as data
      Bluetooth: GATT: Use sys_slist_t to represent the database

Sathish Narasimman (5):
      Bluetooth: AT: Unit test application init
      Bluetooth: HFP HF: Lookup table for unsolicited commands
      Bluetooth: HFP HF: Add support for RING indication cb
      Bluetooth: HFP HF: Support to send hf AT command
      Bluetooth: AT: Fix - chance of missing UNSOLICITED state

Vinayak Chettimada (17):
      Bluetooth: controller: Kconfig for advanced event preparation
      Bluetooth: controller: Kconfig option for advanced scheduling
      Bluetooth: controller: Hide advance features in Kconfig
      Bluetooth: controller: Move comp id and subver to configuration
      Bluetooth: Kconfig: Move BLUETOOTH_CONTROLLER to Controller file
      Bluetooth: Kconfig: Group stack size related options
      Bluetooth: Kconfig: Group HCI_RAW related options
      Bluetooth: Kconfig: Move BLUETOOTH_MAX_SCO_CONN to BR/EDR
      Bluetooth: Compile BR/EDR independent of BLUETOOTH_CONN check
      Bluetooth: Permit connectionless host-controller combined build
      Bluetooth: controller: Cleanup redundant ticker busy loop
      Bluetooth: controller: Move nRF5 specific debug pins to hal/nrf5
      Bluetooth: controller: Remove util/config.h
      Bluetooth: controller: Make worker and job priority configurable
      Bluetooth: controller: Add BT 5.0 PDU structs
      Bluetooth: controller: Group dup filter Kconfig with buf options
      Bluetooth: controller: Use defined keyword in #if cond compiles

 include/bluetooth/gatt.h                      |   2 +-
 include/bluetooth/hci.h                       |  41 ++++++
 include/bluetooth/hfp_hf.h                    |  50 +++++++
 samples/bluetooth/handsfree/src/main.c        |   6 +
 subsys/bluetooth/Kconfig                      |  12 +-
 subsys/bluetooth/controller/Kconfig           | 120 ++++++++++++++-
 subsys/bluetooth/controller/hal/debug.h       | 199 +------------------------
 subsys/bluetooth/controller/hal/nrf5/debug.h  | 204 ++++++++++++++++++++++++++
 subsys/bluetooth/controller/hci/hci.c         | 132 ++++++++++++++++-
 subsys/bluetooth/controller/hci/hci_driver.c  |  24 ++-
 subsys/bluetooth/controller/ll_sw/ctrl.c      | 152 ++++++++-----------
 subsys/bluetooth/controller/ll_sw/ctrl.h      |  21 ++-
 subsys/bluetooth/controller/ll_sw/ll.c        |  14 +-
 subsys/bluetooth/controller/ll_sw/pdu.h       |  20 +++
 subsys/bluetooth/controller/ticker/ticker.c   | 127 +++++++---------
 subsys/bluetooth/controller/util/config.h     |  30 ----
 subsys/bluetooth/controller/util/mayfly.c     |   2 -
 subsys/bluetooth/controller/util/mayfly.h     |   7 +
 subsys/bluetooth/host/Kconfig                 | 120 +++++++--------
 subsys/bluetooth/host/Makefile                |  32 ++--
 subsys/bluetooth/host/at.c                    |  28 +++-
 subsys/bluetooth/host/at.h                    |   3 +-
 subsys/bluetooth/host/conn.c                  |  15 ++
 subsys/bluetooth/host/conn_internal.h         |  11 +-
 subsys/bluetooth/host/gatt.c                  |  66 ++++-----
 subsys/bluetooth/host/hci_core.c              |  11 +-
 subsys/bluetooth/host/hci_core.h              |   2 +
 subsys/bluetooth/host/hci_ecc.c               | 169 +++++++++++++--------
 subsys/bluetooth/host/hfp_hf.c                | 138 ++++++++++++++++-
 subsys/bluetooth/host/l2cap.c                 |   7 +-
 subsys/bluetooth/host/monitor.c               | 108 +++++++++++---
 subsys/bluetooth/host/monitor.h               |  13 +-
 subsys/bluetooth/host/smp.c                   |   2 +-
 tests/bluetooth/init/prj_controller.conf      |   4 +
 tests/bluetooth/init/prj_controller_4_0.conf  |   4 +
 tests/bluetooth/init/prj_controller_dbg.conf  |   4 +
 tests/bluetooth/init/prj_controller_tiny.conf |  21 +++
 tests/bluetooth/shell/src/main.c              |  39 ++++-
 tests/bluetooth/shell/testcase.ini            |   2 +-
 tests/unit/bluetooth/at/Makefile              |   4 +
 tests/unit/bluetooth/at/prj.conf              |   5 +
 tests/unit/bluetooth/at/src/Makefile          |   4 +
 tests/unit/bluetooth/at/src/main.c            |  76 ++++++++++
 tests/unit/bluetooth/at/testcase.ini          |   4 +
 44 files changed, 1408 insertions(+), 647 deletions(-)
 create mode 100644 subsys/bluetooth/controller/hal/nrf5/debug.h
 delete mode 100644 subsys/bluetooth/controller/util/config.h
 create mode 100644 tests/bluetooth/init/prj_controller_tiny.conf
 create mode 100644 tests/unit/bluetooth/at/Makefile
 create mode 100644 tests/unit/bluetooth/at/prj.conf
 create mode 100644 tests/unit/bluetooth/at/src/Makefile
 create mode 100644 tests/unit/bluetooth/at/src/main.c
 create mode 100644 tests/unit/bluetooth/at/testcase.ini

Change-Id: I3b0f10cdbc59bcaeaea0a1bd8f613e42c829b13f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-10 12:10:41 +03:00
Johan Hedberg ba7b6b1ced Bluetooth: tests/shell: Limit BR/EDR configuration to Qemu for now
The BR/EDR configuration doesn't fit e.g. the Arduino 101 anymore.
Limit it to Qemu for the time being, which is anyway the primary
target where the functionality is being tested.

Change-Id: I9a34c82157d56079e43acabe29eeadd6d99e03fe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-09 19:05:34 +03:00
Anas Nashif 24183ffe3e tests: tickless: remove unused code
Change-Id: I6bf2d0a5205c72c6a0cd2193fe97e60c45c83471
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-09 15:45:19 +00:00
Anas Nashif 2fceb7260d tests: move fs test to tests/subsys/
Change-Id: Ic9a02cb9dc2376b2818740d31eb8e8a71526cbb8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-09 15:45:18 +00:00
Sharron LIU 9de266d40c tests: kernel: add test point k_cpu_atomic_idle
tests/kernel/context:
added test point to cover k_cpu_atomic_idle.

Jira: ZEP-1242

Change-Id: Id09c89fd367d527ea1087e6eb2bdba29a338ceaf
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-04-09 15:45:02 +00:00
Qiu Peiyang 9f98bb44ae tests: driver: uart: fix unchecked return value
Coverity points out that uart_irq_update() return value
should be checked.

Coverity-CID: 166776

Change-Id: I3a754dae9e8f1563f4879e2fadfd89621785de8f
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-04-09 15:07:44 +00:00
Sharron LIU 34dc39d435 tests: kernel: added clock_test
tests/kernel/common:
added test case to cover kernel clocks service.
https://www.zephyrproject.org/doc/kernel/timing/clocks.html

Jira: ZEP-1242

Change-Id: I40a06dd9d4dcb1ed24d488088eb2e456740c3bad
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-04-09 15:06:59 +00:00
Carles Cufi b37f743a13 Bluetooth: test: Add "tiny" controller configuration
Add a configuration that strips the BLE controller down to its simplest
form to catch any issues when commonly used options are not enabled.

Change-Id: Ifbec01d62b7d45fe9139dadaba734eff3b7a72b6
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-08 20:11:55 +03:00
Carles Cufi 27e83660ff Bluetooth: controller: Implement scan duplicate filter
Implement the controller's ability to drop duplicate advertising reports
when instructed by the Host.

Jira: ZEP-1246

Change-Id: I2d1b7abf1ed950dde705e5df30a858c595f3834c
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada 7c22073195 Bluetooth: controller: Make worker and job priority configurable
Add Controller advanced Kconfig options to select IRQ
priorities of the Radio, Ticker's Worker and JOB IRQs.

This will provide an opportunity to have peripheral IRQ's
of higher level than Bluetooth Controller.

Change-id: Iaa128c1cd64a309a77d42d485fdefe68f31e4895
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada f38d57cba3 Bluetooth: controller: Kconfig option for advanced scheduling
Add Kconfig option to enable advanced scheduling in the
controller.

Enable non-overlapping placement of observer, initiator and
master roles in timespace. Uses window offset in connection
updates and uses connection parameter request in slave role
to negotiate non-overlapping placement with active master
roles to avoid slave roles drifting into active master
roles in the local controller.

This feature maximizes the average data transmission amongst
active concurrent master and slave connections while other
observer, initiator, master or slave roles are active in the
local controller.

Disabling this feature will lead to overlapping role in
timespace leading to skipped events amongst active roles.

Change-id: I16e4e6c3ca99f93987ab86924af0cb9d76bdbc7e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada 646726518f Bluetooth: controller: Kconfig for advanced event preparation
Added Kconfig option to enable advanced event preparation
feature.

Enables advanced event preparation offset ahead of radio
tx/rx, taking into account predictive processing time
requirements in preparation to the event, like control
procedure handling and CPU execution speeds. Crystal
oscillator is retained between closely spaced consecutive
radio events to reduce the overall number of crystal
settling current consumptions.

This feature maximizes radio utilization in an average role
event timeslice when they are closely spaced by using a
reduced offset between preparation and radio event.

By disabling this feature, the controller will use a
constant offset between the preparation and radio event. The
controller will toggle crystal oscillator between two
closely spaced radio events leading to higher average
current due to increased number of crystal settling current
consumptions.

Change-id: I19e640f7395ac7938873ef4bfac38acf8d6f7e0e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Sathish Narasimman 95c4d0c1f3 Bluetooth: AT: Unit test application init
AT Module unit testing application to verify at_parse_input,
at_parse_cmd_input, at_get_number.

Change-Id: I256c0f9b62c13bc6f22eac4b94118b5fc7643462
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
2017-04-08 20:11:54 +03:00
Jukka Rissanen 5d7a7c253a ztest: Give error if user has not defined CONFIG_ZTEST
If user is trying to use ztest by including ztest.h but has
not defined CONFIG_ZTEST, then fail the compilation as the
result binary will not do anything.

There is no check for CONFIG_ZTEST for unit tests that are run
without qemu.

Change-Id: Ief9bba3a3a0f6acc6a264f17cde828b6d7e543a5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-08 12:13:50 +00:00
Jon Medhurst a89ed6d7d5 tests: dma: Initialise callback enable flags
The test failed to initilise these to known states, so fix this by
asking for end of transfer and error callbacks.

Change-Id: I523168381329062ec0c17aa41cb4033b78d8ed99
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2017-04-05 17:18:23 +00:00
Anas Nashif e5f150f0d9 tests: rename TICKS_UNLIMITED -> K_FOREVER
Change-Id: I1d65c7a0302b2dda0bc23e38f94f7be51de0f917
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-04 19:52:50 +00:00
Anas Nashif 7a90ab448b tests: port static_idt test to unified kernel
Change-Id: Ida4333b91ad322ff676cfbaa2ccaab0bdd38cd48
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-04 12:34:38 -04:00
Anas Nashif 7d5be2af73 Merge "Merge net branch into master" 2017-04-01 20:46:11 +00:00
Qiu Peiyang fe415dbf62 tests: drivers: spi: fix variable type mismatches
These were flagged by icx build.

Jira: ZEP-1887

Change-Id: Iaeedb13be23e86ebfb29a6441574b7384ae836e1
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-04-01 20:36:03 +00:00
Tomasz Bursztyka 8108a608ff net/mgmt: Mask vs event should be verified part by part
It needs to check if current event matches:

- cb's layer
- cb's layer code
- cb's command

If none match, it will not raise the event.

Fixing the unit test as layer must be always != 0.

Jira: ZEP-1940

Change-Id: Iadd63e751fa6e534a10e7da9cae0f5bb5a384461
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 12:15:29 +00:00
Tomasz Bursztyka dc7be7c54f net/ieee802154: Disable ACK reply handling by default
Most (if not all) 802.15.4 devices can handle ACK replies by
themselves.

Change-Id: I0319d59de767b20eb67c1592bacaa4a7b7015cad
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka 5e3354dad5 net/ieee802154: We don't get the MFR from device drivers
commit id 7a11439020 changed this.
Hopefully that changed did not affect anything.

Reducing minimal frame length and applying the change everywhere where
relevant.

Change-Id: I5ae203751bfcf70cef833620106d2c2d0e33b7a5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka 82709802a9 tests/net/ieee802154: Add a unit test for secured data frame validation
Change-Id: I3e35d13d1fdfacb6625dfe1b7b30cc2354a7ee93
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:28 +02:00
Tomasz Bursztyka cca117d8b9 tests/net/ieee802154: Switch l2 to ztest framework
Change-Id: Ibce93d4652e3991a06e870fc81e952788f0c6465
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:27 +02:00
Tomasz Bursztyka 7f50b56c0e tests/net/ieee802154: Add a simple CC2520 crypto dev test
It will first run the datasheet example.

Change-Id: Ic4da5ba9170a253cfdff4b17010d72dc86376555
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 10:39:33 +02:00
Jukka Rissanen a8dc0e60aa net: tests: Fix nbr lookup in route tests
The neighbor was added very fragile way into neighbor cache which
caused following queries to fail. This is now fixed by manually
adding neighbor to the cache.

Change-Id: I1831557fd5f9df5afd0a6c6833b0af769f5167eb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00
Jukka Rissanen 625870a2f6 net: rpl: Temporarily disable some of the RPL tests
Couple of tests started to fail without any apparent reason.
Disabling them temporarily until the root cause is found.

Change-Id: Id82e0eab60dc744c8ce6f02a5834e731be153883
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-31 10:58:17 +03:00
Anas Nashif e698c9c5aa tests: do not build with legacy API enabled
Change-Id: Ie1b6a808797774e5e04e1a1219861443e72cfeca
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-29 16:02:45 -04:00
Flavio Santes c3f79e1d46 test/crypto: Update ECC DSA test case
The ECC DSA test case was updated in TinyCrypt 0.2.6.

Fix the length of the random vector.

Change-Id: I7545a51c6855959afdefe00a1e0b53e5c3001a7c
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-25 15:42:13 +00:00
Flavio Santes 3692aed6a8 test/crypto: Update ECC DH test case
The ECC DH test case was updated in TinyCrypt 0.2.6.

This patch adds two helper arrays for the Monte Carlo routine.

Change-Id: If28292512b351feffc3fe470942cd97b18851a57
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-25 15:42:13 +00:00
Leandro Pereira a50c1d0620 test: Add test for JSON library
This adds a test suite for the JSON library, testing both encoding and
decoding of all supported data types, including arrays, nested objects,
and basic types such as booleans, numbers, and strings.

Jira: ZEP-1607
Change-Id: I4f6ad7e2859a142e06d405e0760e91751e01a31f
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-03-25 13:11:55 +00:00
Anas Nashif 0505c9c881 benchmarks: convert latency_measure to unified kernel
Change-Id: If92833d699b95f5a7e813d0577f5467b06d3a1b6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-25 12:38:50 +00:00
Anas Nashif 25aa9e8e36 tests: enable syslog for sensors
Change-Id: If866083d5707a83b1df0a3411f3a848fdf40dbcb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-25 12:00:30 +00:00
Anas Nashif 2c04055970 Merge "Merge bluetooth branch into master" 2017-03-25 11:25:43 +00:00
Anas Nashif 8ec959a041 Merge "Merge net branch into master" 2017-03-25 11:25:33 +00:00
Johan Hedberg 93fbca0d16 Merge bluetooth branch into master
- Controller cleanups
 - Refactor controller for a cleaner Link Layer abstraction
 - SDP enhancements
 - Use sys_slist_t API wherever possible
 - Fix race condition in controller
 - Update controller to report Bluetooth 5.0 version

----------------------------------------------------------------
Carles Cufi (6):
      Bluetooth: controller: Remove unused H:4 tag macros
      Bluetooth: controller: Rename downstream API calls
      Bluetooth: controller: Introduce BLUETOOTH_LL_SW
      Bluetooth: controller: Move ll.h to an include folder
      Bluetooth: controller: Remove public address config option
      Bluetooth: controller: Move LL code from driver to ll_sw

Johan Hedberg (11):
      Bluetooth: Make bt_hci_driver instances link-time constants
      Bluetooth: shell: Fix missing initialization of param.own_addr
      Bluetooth: shell: Add command to start continuous passive scanning
      Bluetooth: Move crypto APIs to dedicated header file
      Bluetooth: Controller: Factor out ECB core code from ecb_encrypt()
      Bluetooth: Controller: Introduce big-endian variant for ECB
      Bluetooth: Introduce public big-endian AES API
      Bluetooth: Controller: Increase default TX buffer count
      Bluetooth: Use specific pointer type for conn->channels
      Bluetooth: ATT: Reorder handler struct for compactness
      Bluetooth: ATT: Refactor PDU handling

Kaustav Dey Biswas (5):
      Bluetooth: SDP: Server: Send service search response
      Bluetooth: SDP: Server: Handle ServiceAttributeRequest
      Bluetooth: SDP: Server: Find the attributes in the record
      Bluetooth: SDP: Server: Send ServiceAttributeResponse
      Bluetooth: SDP: Server: Support ServiceSearchAttributeRequest

Luiz Augusto von Dentz (4):
      Bluetooth: ipsp: Fix checking for NULL pointer
      Bluetooth: L2CAP: Use sys_slist_t for connection channels
      Bluetooth: L2CAP: Use sys_slist_t for server channels
      Bluetooth: L2CAP: Use sys_slist_t for fixed channels

Mariusz Skamra (2):
      Bluetooth: L2CAP: Fix TX queueing for LE CoC
      Bluetooth: tester: Fix UART issue on qemu

Matthias Ringwald (1):
      Bluetooth: Controller: Kconfig company id and subversion number

Sathish Narasimman (5):
      Bluetooth: HFP HF: SCO: Handle synchronous_conn_complete
      Bluetooth: SCO: Rename 'conn' to 'acl'
      Bluetooth: HFP HF: SCO: Handle SCO Disconnect
      Bluetooth: HFP HF: SCO Initiate Audio connection
      Bluetooth: AT: Fix reset the state during error

Vinayak Chettimada (16):
      Bluetooth: Controller: Fix RSSI feature conditional compilation
      Bluetooth: Controller: Add advertisement event indication feature
      Bluetooth: Controller: Add Kconfig range check for public address
      Bluetooth: Controller: Version 5.0 and PDU type rename
      Bluetooth: controller: Use explicit paths to internal headers
      Bluetooth: controller: Move bt_rand into separate file
      Bluetooth: Make LE Encrypt helpers public
      Bluetooth: controller: Replace 0 for pointers with NULL keyword
      Bluetooth: Fix checks for changes in connection parameters
      Bluetooth: Support connection parameter update as central
      Bluetooth: shell: Reorder commands in logical order of use
      Bluetooth: shell: Add connection update command
      Bluetooth: controller: Move PDU macros from radio.h to pdu.h
      Bluetooth: controller: Cleanup makefiles
      Bluetooth: controller: Fix mayfly caller id for thread call path
      Bluetooth: controller: Fix race waiting for ticker job to complt

 drivers/bluetooth/hci/h4.c                         |   2 +-
 drivers/bluetooth/hci/h5.c                         |   2 +-
 drivers/bluetooth/hci/spi.c                        |   2 +-
 include/bluetooth/bluetooth.h                      |  15 +-
 include/bluetooth/conn.h                           |  11 +
 include/bluetooth/crypto.h                         |  77 ++
 include/bluetooth/hci.h                            |  24 +
 include/bluetooth/l2cap.h                          |   4 +-
 include/drivers/bluetooth/hci_driver.h             |   2 +-
 samples/bluetooth/ipsp/src/main.c                  |   6 +-
 subsys/bluetooth/Kconfig                           |   2 +-
 subsys/bluetooth/controller/Kconfig                |  39 +-
 subsys/bluetooth/controller/Makefile               |  23 +-
 subsys/bluetooth/controller/hal/Makefile           |   1 +
 subsys/bluetooth/controller/hal/ecb.h              |   3 +
 subsys/bluetooth/controller/hal/nrf5/Makefile      |   3 +
 subsys/bluetooth/controller/hal/nrf5/cntr.c        |   4 +-
 subsys/bluetooth/controller/hal/nrf5/ecb.c         |  64 +-
 subsys/bluetooth/controller/hal/nrf5/radio.c       |  17 +-
 subsys/bluetooth/controller/hal/nrf5/rand.c        |   4 +-
 subsys/bluetooth/controller/hal/radio.h            |   5 -
 subsys/bluetooth/controller/hci/Makefile           |   4 +
 subsys/bluetooth/controller/hci/hci.c              |  76 +-
 subsys/bluetooth/controller/hci/hci_driver.c       | 217 +-----
 subsys/bluetooth/controller/include/ll.h           |  58 ++
 subsys/bluetooth/controller/ll/ll.h                |  29 -
 subsys/bluetooth/controller/ll_sw/Makefile         |   4 +
 subsys/bluetooth/controller/ll_sw/crypto.c         |  54 ++
 subsys/bluetooth/controller/{ll => ll_sw}/ctrl.c   | 660 +++++++++--------
 subsys/bluetooth/controller/{ll => ll_sw}/ctrl.h   |  54 +-
 .../controller/{ll => ll_sw}/ctrl_internal.h       |   6 +-
 subsys/bluetooth/controller/{ll => ll_sw}/ll.c     | 237 ++++++-
 subsys/bluetooth/controller/{ll => ll_sw}/pdu.h    |  64 +-
 subsys/bluetooth/controller/ticker/Makefile        |   3 +
 subsys/bluetooth/controller/ticker/ticker.c        |  12 +-
 subsys/bluetooth/controller/util/Makefile          |   1 +
 subsys/bluetooth/controller/util/memq.c            |   5 +-
 subsys/bluetooth/host/Kconfig                      |  16 +-
 subsys/bluetooth/host/Makefile                     |   2 +
 subsys/bluetooth/host/at.c                         |   7 +-
 subsys/bluetooth/host/att.c                        | 204 ++++--
 subsys/bluetooth/host/conn.c                       | 148 +++-
 subsys/bluetooth/host/conn_internal.h              |  12 +-
 subsys/bluetooth/host/crypto.c                     | 155 ++++
 subsys/bluetooth/host/crypto.h                     |   8 +
 subsys/bluetooth/host/hci_core.c                   | 150 ++--
 subsys/bluetooth/host/hci_core.h                   |   2 +-
 subsys/bluetooth/host/hci_ecc.c                    |   9 +-
 subsys/bluetooth/host/hci_ecc.h                    |   5 +-
 subsys/bluetooth/host/hci_raw.c                    |   8 +-
 subsys/bluetooth/host/hci_raw_internal.h           |   2 +-
 subsys/bluetooth/host/l2cap.c                      | 202 ++----
 subsys/bluetooth/host/l2cap_br.c                   |  97 +--
 subsys/bluetooth/host/l2cap_internal.h             |   5 +-
 subsys/bluetooth/host/sdp.c                        | 781 +++++++++++++++++++++
 subsys/bluetooth/host/sdp_internal.h               |  14 +
 subsys/bluetooth/host/smp.c                        |  36 +-
 tests/bluetooth/init/prj_controller_4_0.conf       |   1 +
 tests/bluetooth/init/prj_controller_dbg.conf       |   1 +
 tests/bluetooth/shell/src/main.c                   | 137 +++-
 tests/bluetooth/test_bluetooth/src/bluetooth.c     |   2 +-
 tests/bluetooth/tester/qemu.conf                   |   1 +
 62 files changed, 2583 insertions(+), 1216 deletions(-)
 create mode 100644 include/bluetooth/crypto.h
 create mode 100644 subsys/bluetooth/controller/hal/Makefile
 create mode 100644 subsys/bluetooth/controller/hal/nrf5/Makefile
 create mode 100644 subsys/bluetooth/controller/hci/Makefile
 create mode 100644 subsys/bluetooth/controller/include/ll.h
 delete mode 100644 subsys/bluetooth/controller/ll/ll.h
 create mode 100644 subsys/bluetooth/controller/ll_sw/Makefile
 create mode 100644 subsys/bluetooth/controller/ll_sw/crypto.c
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl.c (93%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl.h (84%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ctrl_internal.h (98%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/ll.c (58%)
 rename subsys/bluetooth/controller/{ll => ll_sw}/pdu.h (77%)
 create mode 100644 subsys/bluetooth/controller/ticker/Makefile
 create mode 100644 subsys/bluetooth/controller/util/Makefile
 create mode 100644 subsys/bluetooth/host/crypto.c
 create mode 100644 subsys/bluetooth/host/crypto.h

Change-Id: Ic8bee0eb4f15c00ce5ca7b3b80133b1bbd0bdbf5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-24 23:21:09 -07:00
Anas Nashif 898c8b639b tests: object_footprint: add missing file
Change-Id: I2d26f0770ac81482d70a8101c22745b2baef64ae
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 18:17:32 -04:00
Anas Nashif e994b0ab19 benchmarks: remove legacy tests already ported to unified
Change-Id: I002a462e06333b8540e96d4e4e166830b231d536
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 18:17:04 -04:00
Anas Nashif 7942eaee39 benchmarks: port object_footprint to unified kernel
Change-Id: Iaa39f60b9ef498059f0320631823a9d7d47a99de
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 21:51:17 +00:00
Anas Nashif 477a928134 benchmarks: move footprint benchmark out of legacy
Those can be used with unified kernel.

Change-Id: I4bd024f7e645b99ac1b8df6dfbbdd94f2fda99c4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 21:51:17 +00:00
Inaky Perez-Gonzalez 6db4a991b2 tests: tag with 'ignore_faults' testcases that provoke faults
This way we can monitor testcases for faults that should not be there;
however, in the case of these, a fault message is expected and shall
be ignored.

Change-Id: I63736723026c381c9fee7f24a751ceafc12f2a40
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-03-24 21:51:16 +00:00
Anas Nashif aa70533244 tests: remove legacy tests already ported to unified
Legacy APIs are to be deprecated, so getting rid of tests that have been
moved to unified kernel already.

Change-Id: I752e42bc498dfdd0ea29b0b5b7b9da1dac7b1136
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-24 21:51:15 +00:00
Jukka Rissanen c3b1070d10 tests: dns: Resolve API test cases
Change-Id: I090515c0e720c5779e3b5a9f2eb19e398ea0e987
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-24 17:31:42 +02:00
Tomasz Bursztyka 1e3dc0cbb4 net/ipv6: Renaming IPv6 neighbor state related macros and function
Refining the names around IPv6's neighbor states to differentiate them
easily from any net_nbr related names (which are not tighten to IPv6).

Change-Id: Ibc24df2a9485477a53fe5fe1c8f993f0fcd91635
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-24 17:31:41 +02:00
Mariusz Skamra ea8ca7d400 Bluetooth: tester: Fix UART issue on qemu
This fixes an issue introduced by bab3aafa2d,
which changed the default value of UART_PIPE_ON_DEV_NAME to the same
used by BLUETOOTH_UART_ON_DEV_NAME. Due to this, the BTP and HCI were using
the same UART.

Change-Id: Ib59819e49610f28f4c89c0304d024bb1b6aa506a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2017-03-24 10:16:08 +01:00
Jithu Joseph 2ddb968cbf tests: kernel: port work_queue test to unified kernel
Jira: ZEP-932

Change-Id: I79eb4cb20cd0e0df60f71cb73969a76e2c929b8e
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-03-23 12:02:35 +00:00
Sergio Rodriguez 9df2afc058 tests: kernel: test_pend: Porting legacy tests to unified kernel
This is the port of the legacy/kernel/test_pend test case to
the unified kernel

Jira: ZEP-932

Change-Id: I81762b45ff7000ff9f6079c674b46d233b2645de
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-03-23 11:50:36 +00:00
Vinayak Chettimada 2037ec803d Bluetooth: shell: Add connection update command
Added conn-update command to btshell module to test
bt_conn_le_param_update Bluetooth API.

Change-id: I205df9ffc12a0ab062de5a779ab96bc91cbd9259
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:43 -07:00
Vinayak Chettimada 30a46529b2 Bluetooth: shell: Reorder commands in logical order of use
Reordered the commands in btshell to represent the logical
order of use. Moved advertise and scan before connect
command.

Change-id: Id64509e39848109a6df7ddb1306b6bd221b65c40
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Johan Hedberg e085ff49b9 Bluetooth: shell: Add command to start continuous passive scanning
Change-Id: I0d9c2f47014464a27ff24ac79a16ee956bbcf62c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Johan Hedberg 1ce1c3484e Bluetooth: shell: Fix missing initialization of param.own_addr
Add proper logging for errors in the same go.

Change-Id: I8bd4fa8d5b143e51024496bfba0056525ad35964
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Johan Hedberg 5517893543 Bluetooth: Make bt_hci_driver instances link-time constants
Declaring these as const lets the linker generate more optimal code.
Some extra care is needed with hci_ecc.c since it was overwriting the
send callback. Now the choice of send() call is done directly in the
bt_send() function

Change-Id: Iac74f5ee9bee097bbb34c11bd13d1d886700f5cc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Vinayak Chettimada 0d75faf02d Bluetooth: Controller: Add advertisement event indication feature
Add a Controller event that indicates everytime
advertisement event has been transmitted on air.

Change-id: I4722488bbfeca987e66983faf5b26467407a89c9
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Michael Scott 081246737c net/http: let HTTP_SERVER, HTTP_CLIENT and HTTP_PARSER select HTTP
Due to commit 8308b9bd2d ("net/http: Add the HTTP/1.1 API")
every user of CONFIG_HTTP_PARSER would need to add CONFIG_HTTP to
their .conf files.  Which is fine for intree samples/tests as they
have been adjusted, but the rest of world working on Zephyr apps
will need to make this changes as well.

Instead, we should have each of the following select HTTP instead of
depend on it, which will make future use of these configs and their
dependencies more intuitive:
HTTP_SERVER
HTTP_CLIENT
HTTP_PARSER

NOTE: As cleanup, this commit also removes the CONFIG_HTTP added to
samples and test .conf files.

Change-Id: I81cfaa19e37333b1bf98778f8147814780e7f77c
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-03-17 10:34:45 +02:00
Jukka Rissanen 157c383260 net: ipv6: Make config options more fine grained
Add CONFIG_NET_IPV6_NBR_CACHE option that is the base for both
neighbor discovery (ND) and duplicate address detection (DAD).

Both ND and DAD can be disabled if needed. If NBR cache is
disabled, then ND and DAD are disabled too.

Note that it makes not much sense to disable DAD or NBR cache
as IPv6 will not work properly without them. It is possible
to disable ND but then the neighbor information needs to come
via other sources like RPL.

Change-Id: I57c8668ad828b3a153dfc58eea78bf5f7ac3938a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Jukka Rissanen fc2542b88b net: tests: Fix the default MAC address
Use the proper MAC address space (00-00-5E-00-53-xx) dedicated
for documentation and specified in RFC 7042 ch 2.1.2.

Change-Id: If8ef9e4ee4e041ad005060664ebafe60df0a6bf9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:43 +02:00
Tomasz Bursztyka 87b80191b6 tests/net/mgmt: Add 2 unit tests around synchronous event listeners.
Test net_mgmt_event_wait() and net_mgmt_event_wait_on_iface()

Change-Id: I82ba70a697f0d13aa2e1eef2110e139b3621c119
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-17 10:34:42 +02:00
Tomasz Bursztyka 35e5aa8865 net/mgmt: Add a function to wait on a event synchronously
Instead of creating a handler and a related callback structure on an
event_mask: net_mgmt_event_wait() can be used to wait synchronously on
such event_mask. The core mgmt part will seamlessly reuse the struct
net_mgmt_event_callback so the whole internal notification mechanism is
using the same code.

Change-Id: I426d782c770e75e5222aa3c5b703172b1f1f2e5e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-17 10:34:42 +02:00
Ravi kumar Veeramally 8cb97ae47d net: Modify IPv4/6 packet finalize API's
Current finalize api's takes buf as input parameter and returns
the finalized buf. But if there are any issue while finalizing,
it failed to throw an error.

Change-Id: I6db54b7453eec41a8051fab50d5c0dc937debd54
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-03-17 10:34:42 +02:00
Ravi kumar Veeramally ad855fc31d net: ipv6: Fix handling of RA 6CO options
As per RFC 6775 4.2, context length holds number of leading bits
in the Context Prefix field that are valid. Rest are not valid
for compression.

Change-Id: Id21cc2d7a5d42980cf9295f85e75c4869ff6cb99
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-03-17 10:34:41 +02:00
Flavio Santes f1ec62ed75 tests/net/dns: Add routines to evaluate DNS responses
This patch adds some routines to evaluate DNS responses as specified
by RFC 1035.

Jira: ZEP-1876

Change-Id: Ia78a1175229962128a0bcee985e507d72ed26aea
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-17 10:34:41 +02:00
Jukka Rissanen 1274a229cc net: tests: nbuf: Fix compiler warnings
LLVM/icx compiler gives warnings for uint16_t vs. size_t
values.

Jira: ZEP-1886

Change-Id: I63c5deea672568946d91421a873c470af3cec6df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-17 10:34:41 +02:00
Flavio Santes 8308b9bd2d net/http: Add the HTTP/1.1 API
This patch adds the HTTP/1.1 API for Zephyr. This API consists of client
and server context structures enabled via Kconfig variables.
HTTP parser support is enabled via the CONFIG_HTTP_PARSER configuration
variable.

Currently, this API only includes support for writing HTTP requests
(client mode) and HTTP responses (server mode). TLS support is not
considered in this iteration.

Supported HTTP methods:
	GET, HEAD, OPTIONS and POST.

Supported HTTP responses:
	400, 403 404. The http_response routine may be used to write
	any HTTP status code, for example 200 OK.

Jira: ZEP-1701

Change-Id: Ic9ccd4d4578d6d0f3a439976ea332b031644ca7d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-09 20:33:49 +02:00
Flavio Santes bed2f43120 tests/net/dns: Add the test case for the DNS low-level routines
This patch adds the test case for the DNS API low-level routines.

The following routines are evaluated by this test case:

- dns_msg_pack_qname
- dns_msg_pack_query
- dns_unpack_header_id
- dns_header_qr
- dns_header_opcode
- dns_header_aa
- dns_header_tc
- dns_header_rd
- dns_header_ra
- dns_header_z
- dns_header_rcode
- dns_header_qdcount
- dns_header_ancount
- dns_header_nscount
- dns_header_arcount
- dns_unpack_query_qclass
- dns_unpack_query_qtype

Next iterations will consider IPv6 and DNS RR coverage.

Jira: ZEP-1499

Change-Id: I4ef46203e6fec57c6fe5a5db8132ed140b412fc2
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-03-09 20:33:49 +02:00
Jukka Rissanen e82f7a6a31 tests: net: Check allnodes and solicit node addresses.
Make sure that the network interface has proper allnodes and
solicit node multicast addresses set.

Change-Id: I2318d63df0b5d09dfaa8347b69c843b84ed63f4b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen 253e9a377f tests: net: Add MLD query tests
Add tests for verifying that we can receive Multicast Listener
Discovery query and act on it.

Change-Id: I926cf5e9f77cd250d2d7094f2379e320ef163540
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen 8d8e3772e6 net: ipv6: Respond to MLD query
If we receive MLDv2 (Multicast Listener Discover) query,
we send out information about the multicast groups that
we have joined.

Change-Id: If4ea9fa685319b2ad900e1949a5cbe12e7696b43
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen d0fc787c21 tests: net: Add unit tests for mld
MLD (Multicast Listerer Discovery) unit tests when joining
or leaving an IPv6 multicast group.

Change-Id: I7cd0f4c5f31c693d816fb5d27d3d23bb27679c35
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:48 +02:00
Jukka Rissanen ba5bb5a9df net: if: Join/leave pre-defined IPv6 multicast groups
When we setup the network interface, add predefined IPv6 multicast
groups into the network interface. When interface is taken down,
then leave all the multicast groups that joined.
See RFC 4291 ch 2.8 for details.

Change-Id: If17d3e8c75157a02aa93c92e2fb499619c1484cf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:47 +02:00
Jukka Rissanen 74e747a27f net: ipv6: Add support to join/leave multicast group
This and subsequent commits adds API to join or leave
an IPv6 multicast group.

Jira: ZEP-1673

Change-Id: I26dcfe16a4527dbf7886a30827a5d4ebfdeaac01
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:47 +02:00
Ravi kumar Veeramally 476f46f61b net: icmpv6: Remove unused variable 'len' from input calls
Variable len is not used in net_icmpv6_input() and if required
it can be obtained from 'buf'.

Change-Id: I4b0710e1cf16cff9837173ad9d6908ec54ebafae
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-03-09 20:33:45 +02:00
Jukka Rissanen 5032bdc46d net: nbuf: Pass ll_reserve when creating TX buffer
Instead of always calling net_nbuf_get_reserve_tx() with zero
ll_reserve (first parameter) and then setting the link layer
reserve separately, pass the reserve to that function which can
then set the ll_reserve in buf itself.

Change-Id: I21c14cb7e2e6c36d170c09998bca0207ecf65c75
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen 189ec2b6ad net: Remove link layer reserve param from IP packet creator
The ll_reserve parameter is useless in net_ipv{4|6}_create_raw()
function as the reserve information is already stored in buf.

Change-Id: I7815a78c001e3da532478c04b3dac9b37bbc723c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen 5197266768 net: nbuf: Use net_nbuf_get_frag() to allocate a fragment
The code used net_nbuf_get_reserve_{rx|tx}_data() function to
allocate a fragment. Instead of that low level function, use
net_nbuf_get_frag() instead. There are few places this is not
possible or is too big change like in few test programs.

Change-Id: Ied7e2b7db352de998b200ffa6ff82471bfa5ebe3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen d32503f57e net: nbuf: Split one global DATA pool to RX and TX DATA pools
If we receive lot of packets, it might happen that we exhaust
all the DATA buffers in the system. This would prevent from
us sending anything to the network.
Change this by splitting the DATA buffer pool into RX and TX
parts. This way RX flooding cannot consume all DATA buffers
that needs to be sent.

Change-Id: I8e8934c6d5fdd47b579ffa6268721b5eb3d64b6d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Jukka Rissanen 4bcc2a47d0 net: nbuf: Fix net_nbuf_copy() so that original nbuf is not modified
It makes no sense to modify the original net_buf so change the
copy function not to touch the original buffer.

Change-Id: I5d22445ce50cee62994c36567f0e995a500cb89d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:42 +02:00
Jukka Rissanen 6a4372b0df net: nbuf: Fix the net_nbuf_copy() buf parameter
The first parameter of net_nbuf_copy() must be the head
of the buffer chain i.e., it must contain the user_data
part. If a fragment is given, then we do not know enough
information to allocate the data fragments.

Change-Id: I052b183d8c63d7326b320254f36f00b2fc48b0a0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:42 +02:00
Johan Hedberg 69d9985429 Merge bluetooth branch into master
- Assert fixes to controller state transitions
 - AVDTP fixes & improvements
 - SDP fixes & improvements
 - HFP improvements
 - GATT fixes
 - New GATT API for getting current MTU

----------------------------------------------------------------
Arun Jagadish (3):
      Bluetooth: AVDTP: Add AVDTP Receive Function
      Bluetooth: AVDTP: Fix discover param struct
      Bluetooth: AVDTP: Rename of variables

Carles Cufi (4):
      Bluetooth: controller: Use direct ISRs
      Bluetooth: controller: Set debug pins with macros
      Bluetooth: controller: Introduce debug pins Kconfig option
      Bluetooth: controller: Report 5.0 compliant controller

Jaganath Kanakkassery (1):
      Bluetooth: SDP: Server: Introduce private define for max services

Johan Hedberg (3):
      Bluetooth: Add support for Bluetooth 5.0 version specifier
      Bluetooth: Relax minimum advertising interval for 5.0 controllers
      Bluetooth: samples: Add combined observer & broadcaster app

Kaustav Dey Biswas (5):
      Bluetooth: SDP: Server: Fix MTU setting after l2cap connection
      Bluetooth: SDP: Server: Set security level to NONE
      Bluetooth: SDP: Server: Refactor data element structure header
      Bluetooth: SDP: Server: Handle Service Search request
      Bluetooth: SDP: Server: Filter records based on requested uuids

Luiz Augusto von Dentz (4):
      Bluetooth: GATT: Use __ASSERT for invalid parameters
      Bluetooth: GATT: Add bt_gatt_get_mtu API
      Bluetooth: L2CAP: Move functions in preparation for queuing
      Bluetooth: L2CAP: Add TX queueing for LE CoC

Maureen Helm (1):
      Bluetooth: samples: Add hexiwear_k64 and frdm_k64f to tests

Piyush Itankar (2):
      Bluetooth: A2DP: Stream End Point Registration
      Bluetooth: A2DP: Added Preset Structure

Sathish Narasimman (4):
      Bluetooth: AT: Fix 'signed' warning
      Bluetooth: HFP HF: Handling AG Network error
      Bluetooth: HFP HF: SCO: Add esco supported pkt type
      Bluetooth: HFP HF: SCO: Accept eSCO conn request

Szymon Janc (9):
      Bluetooth: shell: Fix accessing invalid memory
      Bluetooth: shell: Fix typo
      Bluetooth: SMP: Fix passkey entry for legacy pairing
      Bluetooth: shell: Don't echo LE CoC data
      Bluetooth: Fix connection object leak
      Bluetooth: shell: Simplify indication in gatt-subscribe
      Bluetooth: shell: Fix GATT long write support
      Bluetooth: GATT: Remove not needed variable
      Bluetooth: GATT: Fix subscriptions removal

Vinayak Chettimada (6):
      Bluetooth: Controller: Use direct ISR for Radio IRQ only
      Bluetooth: Controller: Fix LE Ping PDU dispatch
      Bluetooth: Controller: Run all enqueued mayfly before disable
      Bluetooth: Controller: Kconfig option to set public address
      Bluetooth: Controller: Fix assert on role stop/abort
      Bluetooth: Controller: mayfly enable to supercede over disable

 include/bluetooth/a2dp-codec.h               |  73 +++++
 include/bluetooth/a2dp.h                     |  61 +++++
 include/bluetooth/conn.h                     |   2 +
 include/bluetooth/gatt.h                     |  11 +
 include/bluetooth/hci.h                      |  50 ++++
 include/bluetooth/l2cap.h                    |   4 +
 include/bluetooth/sdp.h                      | 103 ++++---
 samples/bluetooth/peripheral_hr/testcase.ini |   2 +-
 samples/bluetooth/scan_adv/Makefile          |   5 +
 samples/bluetooth/scan_adv/README.rst        |  25 ++
 samples/bluetooth/scan_adv/prj.conf          |   2 +
 samples/bluetooth/scan_adv/src/Makefile      |   1 +
 samples/bluetooth/scan_adv/src/main.c        |  75 +++++
 samples/bluetooth/scan_adv/testcase.ini      |   4 +
 subsys/bluetooth/controller/Kconfig          |  15 +
 subsys/bluetooth/controller/hal/debug.h      | 124 ++++-----
 subsys/bluetooth/controller/hal/nrf5/radio.c |   4 +-
 subsys/bluetooth/controller/hal/radio.h      |   2 +-
 subsys/bluetooth/controller/hci/hci.c        |   2 +-
 subsys/bluetooth/controller/hci/hci_driver.c |  22 +-
 subsys/bluetooth/controller/ll/ctrl.c        | 229 ++++++++++++----
 subsys/bluetooth/controller/util/mayfly.c    |  58 +++-
 subsys/bluetooth/controller/util/mayfly.h    |   4 +-
 subsys/bluetooth/host/Kconfig                |   9 +
 subsys/bluetooth/host/a2dp.c                 |  19 ++
 subsys/bluetooth/host/at.c                   |  53 +++-
 subsys/bluetooth/host/at.h                   |  38 ++-
 subsys/bluetooth/host/avdtp.c                |  63 ++++-
 subsys/bluetooth/host/avdtp_internal.h       |  14 +-
 subsys/bluetooth/host/conn.c                 |  60 +++-
 subsys/bluetooth/host/conn_internal.h        |  10 +
 subsys/bluetooth/host/gatt.c                 |  86 +++---
 subsys/bluetooth/host/hci_core.c             |  92 ++++++-
 subsys/bluetooth/host/hci_core.h             |   8 +
 subsys/bluetooth/host/hfp_hf.c               |  15 +-
 subsys/bluetooth/host/l2cap.c                | 319 +++++++++++++---------
 subsys/bluetooth/host/sdp.c                  | 391 +++++++++++++++++++++++++--
 subsys/bluetooth/host/sdp_internal.h         |   2 +
 subsys/bluetooth/host/smp.c                  |   1 -
 tests/bluetooth/shell/src/main.c             |  98 ++++---
 40 files changed, 1728 insertions(+), 428 deletions(-)
 create mode 100644 include/bluetooth/a2dp-codec.h
 create mode 100644 samples/bluetooth/scan_adv/Makefile
 create mode 100644 samples/bluetooth/scan_adv/README.rst
 create mode 100644 samples/bluetooth/scan_adv/prj.conf
 create mode 100644 samples/bluetooth/scan_adv/src/Makefile
 create mode 100644 samples/bluetooth/scan_adv/src/main.c
 create mode 100644 samples/bluetooth/scan_adv/testcase.ini

Change-Id: I94f2f9f4431e21da9aae00c9e32581acb383ad49
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-08 22:21:41 +01:00
Qiu Peiyang 8d4f1bcb78 tests/gpio: enable gpio cases to run on more platforms
Add pin definitions to enable GPIO cases to run on
Quark D2000.
Add pin definitions to enable GPIO cases to run on
arduino_101_sss.

Change-Id: I97eadb8316b1f80b899b167a01effab815626dae
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-03-07 23:03:01 +00:00
Qiu Peiyang 935663f05e tests: fix disabling of GPIO interrupt issue
According to ZEP-1717, removing the callback from
the gpio is not enough to disable interruptions.
You also need to call gpio_pin_configure() on
the input pin without the GPIO_INT flag to totally
disable the interrupt for the pin.

This commit will stop level interrupt from being
fired constantly.

Change-Id: I019d7cea0bc0d5e5ff4b74165472ed11de1733bb
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-03-07 23:01:52 +00:00
Qiu Peiyang 2d033483de tests: add zephyr pinmux driver api test case
This commit verifies the following pinmux driver apis:
	pinmux_pin_set()
	pinmux_pin_get()

Change-Id: Iedf1b4e918b518b2205e9059b3b08f41cd243d37
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-03-07 23:01:28 +00:00
Qiu Peiyang 1124da16de tests: add zephyr SPI driver api test case
This commit verifies the below SPI driver apis:
	spi_configure()
	spi_slave_select()
	spi_write()
	spi_transceive()

Verify SPI work in SPI_MODE_CPOL, SPI_MODE_CPHA,
and SPI_MODE_CPOL | SPI_MODE_CPHA.

Jira: ZEP-1626

Change-Id: I1985ac6ff8269ac908817644a844720f2d7a125c
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-03-07 23:00:54 +00:00
Jithu Joseph fbde97d44a tests: drivers: uart: fix variable type mismatches
These were flagged by icx build.

Jira: ZEP-1864

Change-Id: I5b8fce64d9e20d768fabf02e2a799e9390e3679a
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-03-07 12:00:33 -08:00
Kaustav Dey Biswas c25df73c5a Bluetooth: SDP: Server: Refactor data element structure header
Separate out data element structure header into type and size fields

Change-Id: I869ee1ea82db1f6d669bb905055135b7d63f3fa2
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2017-03-07 12:21:29 +01:00
Szymon Janc dc2ce98088 Bluetooth: shell: Fix GATT long write support
Parameters and data must be permament for time of the operation.

Change-Id: Idd4eee948e62c2c80648116a339558042059f801
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 10ce50dc30 Bluetooth: shell: Simplify indication in gatt-subscribe
Instead of passing exact value allow to use 'ind' for enabling
indications instead of notifications.

Change-Id: I24306a321ed90b4bcb6300846218ff7214b39bc4
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 667e3af3dd Bluetooth: shell: Don't echo LE CoC data
Don't echo data from received callback as this can cause
deadlock. Just dump incoming data instead.

Change-Id: Iedbbafd0406ad46ba2c9d26fd8a70fff59de8143
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 691397023b Bluetooth: shell: Fix typo
Change-Id: I2c1a6e7cb61f65ce2292f128e73dc2d80372f773
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc af7d0c64a8 Bluetooth: shell: Fix accessing invalid memory
argc needs to be check before accessing argv.

Change-Id: I9cb70906a388b96df4e192dd4f31eafdab25127f
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Anas Nashif 4172b260c7 tests: sprintf: fixed sprintf usage
Change-Id: I2b55282a96d9df8f03be115a7e5c38f43fd5eca3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-03 18:38:06 +00:00
Anas Nashif 27e4fa0d7f tests: profiling: disable em_starterkit
Change-Id: Id31773e7355933476bad9f69669fa92dd2a32dad
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-03-02 19:39:46 -05:00
Kumar Gala 91e9f87499 libc: attribute minimal libc printf style functions with __printf_like
Add __printf_like attribute to printf style functions in minimal libc to
enable the compiler checking this provides.  We fixup the associated
issues that are now found by utilizing these checks.

Change-Id: I74ac0d0345782463d9fb454f7161d6b4af211ba5
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-03-02 08:46:30 -06:00
Benjamin Walsh 65ab86cf87 ztest: shorten line longer than 80 characters
Change-Id: I8156299180f027e95fe2858903de37abff09ba76
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:33 +00:00
Benjamin Walsh 67b816d74c ztest: rename end-of-test semaphore
It was named 'mutex', which is not representative of what it is used for
since it is not used for mutual exclusion, but rather for signaling.

Change-Id: Icfef0011f890b2546af1686ba6b57e3fc13c6576
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:33 +00:00
Benjamin Walsh 75e643d532 ztest: add comment about expected thread priorities
There is an implicit expectation that the priority of threads spawned by
a ztest suite is still higher than the main suite thread own priority
when a test signals the main suite thread that it has completed.

Change-Id: Id7caec3e9e553712c828a93c212b8e82bd16eabd
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:32 +00:00
Benjamin Walsh e307d9efa8 tests/common/timeout_order: reset test case thread to original prio
That was an oversight that should not have caused any problem. However,
the test harness expects the test's thread to be higher prio than the
test suite's thread that spawns it, because the test suite reuses the
stack space for the next test, if there is one.

Change-Id: Iad951118278abf0d9c23012d78ed56b75bc2958a
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-03-01 13:18:31 +00:00
Anas Nashif cd35c575ef Revert "sys_bitfield*(): use 'void *' instead of memaddr_t"
This reverts commit 1f2ee5c6bc.

Change-Id: I6d6662952450e54aea2ffbc43973a5ecc40767bb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-28 16:06:22 -05:00
Inaky Perez-Gonzalez 1f2ee5c6bc sys_bitfield*(): use 'void *' instead of memaddr_t
Current users of sys_bitfield*() are bending over backwards to cast
what is most of the times a pointer into an integer.

Bitfields can be better described with an void *, so
uint{8,16,32,64}_t or any other container can be used. Most
sys_bitfield*() operations, by extension, can do the same. Note void *
has byte arithmetic, like char *.

This change will also make it implicit, for any future split of the
address space between virtual (what the SW is seeing) and physical
(what the HW is seeing) way clearer, as the functions dealing with
physical, non directly referentiable/mappeable addreses to use an
integer type, like mem_addr_t.

- include/arch/ARCH/*asm_inline*:

  - sys_bitfield*() all modified to take 'void *'

    Note 'void *' arihtmethic is byte based, which makes some things
    easier.

- include/sys_io.h:

  - introduces DEFINE_BITFIELD
  - update docs

- tests/kernel/bitfield: remove all the cast contortions, use DEFINE_BITFIELD
  PENDING: update other TCs

- include/arch/nios/nios2.h, drivers/interrupt_controller/ioapic_intr.c:
  remove cast contortions

Change-Id: I901e62c76af46f26ff0d29cdc37099597f884511
Jira: ZEP-1347
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-02-28 14:37:54 +00:00
Sharron LIU 9896f32445 tests: kernel: added test cases k_pipe_block_put
tests/kernel/pipe/test_pipe_api:
added test cases to cover k_pipe_block_put.
Also added test case to verify [get, put] API sequence.

Jira: ZEP-1242

Change-Id: I755def474592ea2bf36d8644c8f4a07a7a80bad0
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-28 13:35:31 +00:00
Sharron LIU 3abc1c5f23 tests: kernel: added testapp profiling_api
tests/kernel/profiling/profiling_api:
added testapp to cover k_call_stack_analyze.

Jira: ZEP-1242

Change-Id: I65de70b2c4e5a294763d625b2a45c990f99f9f90
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-28 13:33:39 +00:00
Anas Nashif c78a3485e2 Merge "Merge net branch into master" 2017-02-27 22:32:01 +00:00
Sharron LIU 83c7e2d862 tests: kernel: add test point k_delayed_work_remaining_get
tests/kernel/workq/workq_api:
added test point to cover k_delayed_work_remaining_get

Jira: ZEP-1242

Change-Id: I15055e9b11dfd28f3e33ac04151df8ccbed97027
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-27 21:22:16 +00:00
Sharron LIU 1087f0c29b tests: kernel: added test case k_fifo_is_empty
tests/kernel/fifo/test_fifo_api:
added test case to cover k_fifo_is_empty.

Jira: ZEP-1242

Change-Id: I9559df8661dbcd7d4885fa2db928120e945b3ae1
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-27 21:22:06 +00:00
Sharron LIU d15d264da9 tests: kernel: added test case k_is_preempt_thread
tests/kernel/threads_scheduling/schedule_api:
added test case to cover k_is_preempt_thread.

Jira: ZEP-1242

Change-Id: I4327438dffaa59abcfe1e41813b45abee88506b2
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-27 21:21:54 +00:00
Luiz Augusto von Dentz 0dc4dd46d4 lifo: Make use of k_queue as implementation
Once all users of k_lifo migrate to k_queue this should no longer be
needed.

Change-Id: Ib8af40c57bf8feba7b06d6d891cfa57b44faad42
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-27 21:20:53 +00:00
Luiz Augusto von Dentz e5ed88f328 fifo: Make use of k_queue as implementation
This makes k_fifo functions rely on k_queue and port k_poll to use
k_queue directly.

Once all users of k_fifo migrate to k_queue this should no longer be
needed.

Change-Id: Icf16d580f88d11b2cb89e1abd23ae314f43dbd20
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-27 21:20:52 +00:00
Luiz Augusto von Dentz d07a328a95 tests: Add queue tests
Change-Id: If4ffa10c8c63788e1c9f074b8761902b4bdf6f66
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-27 21:20:51 +00:00
Adithya Baglody 979f75053c Disabled BOOT_BANNER for boot time benchmarks.
Change-Id: Ife23cd784e684d667bf78b616c478c891860e6e2
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-02-27 14:54:17 +05:30
Vinicius Costa Gomes 8e304ef2e6 iot/zoap: Fix requiring that the buffer is unchanged for retransmit
It is possible that the buffer waiting for retransmission is modified
after it is sent, for example, it can be compacted by 6lo, and our
assumption of where is the message ID is located in the buffer is no
longer valid.

As the message ID is the only information that is necessary for
keeping track of retransmissions, we keep a copy of it in the pending
struct, as well as the destination address of the retransmission.

Change-Id: Id33d54353404628673541225a1a05e27ee08765f
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-02-27 10:28:54 +02:00
Vinicius Costa Gomes 45fe87a425 tests/zoap: Adds test for the length of payload on the RX side
This unit test verifies that zoap_packet_get_payload() returns the
expected size for received packets.

Jira: ZEP-1662

Change-Id: Ibe011959f4d6593f4f20f0f5901c9033c76c9518
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-02-27 10:28:54 +02:00
Anas Nashif 33746d4b7c Revert "tests/crypto: Update testcase.ini to build on more platforms"
This reverts commit 7b652b1f84.

Breaks on many boards.

Change-Id: Ie74e7a656094a54b999b99de9a462093525202c3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-23 07:13:42 -08:00
Erwan Gouriou e895d576db tests: update uart driver api test case
Depending on test environment, termination character could
be '/r' instead of '/n'.
Enabling both possibilities.

Change-Id: I18b47e9055667e0a4f868416ee8d01226a879712
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-02-23 13:30:47 +00:00
Sergio Rodriguez b6cf56e5cc tests: watchdog: Interrupt reset mode modifications
In order for interrupt reset mode to work (reset the processor
after and interrupt) the interrupt does not has to be cleared,
and the qmsi hal layer clears the interrupt after the callback
has been invoked, the callback does not return and the processor
should reset.

Jira: ZEP-1566

Change-Id: Ic951a0f15fe95fb0ef5d752b831c62e6fa3ceea0
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-02-23 13:29:13 +00:00
Kuo-Lang Tseng 4533734dc6 aon_counter test: fix misspelling in the header include guard
The include guard has a misspelling.

Jira: ZEP-1746

Change-Id: I4d8000ef5c8e037f80acbf2491d0b9466670816a
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-23 13:23:35 +00:00
Flavio Santes 7b652b1f84 tests/crypto: Update testcase.ini to build on more platforms
This patch excludes qemu riscv32 due to the following msg:

qemu-system-riscv32: cannot set up guest memory
'riscv_sifive_board.ram': Cannot allocate memory

Jira: ZEP-1721

Change-Id: Ib1784fa57ad1e3d69871d4e216af1ad5dbe55a76
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-23 13:19:21 +00:00
Andre Guedes c7f01dc90d tests/power/multicorei/lmt: Fix RTC configuration
After QMSI 1.4 update, the alarm callback is not saved when
'alarm_en' is set to zero during RTC configuration. So this
patch fixes tests/power/multicore/lmt application according.

ZEP-1778

Change-Id: Ie1468458bc23a6394484aef2aeee97745d5d23b8
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2017-02-23 13:17:47 +00:00
Jukka Rissanen 4eb2020055 net: Set the network link address type when setting link address
The interface L2 address type is set at the same time as the
L2 address is set to the network interface. This is most
convinient place to set the address type.

Change-Id: I712d7357d075959eb79df3463141cfbc6d163a74
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-22 17:28:25 +02:00
Flavio Santes 216ccb7198 tests/mqtt: Fix compiler warnings in MQTT Packet test case
Cast to uint8_t * some char * values to avoid compiler warnings.

Jira: ZEP-1179

Change-Id: I9973eecbed357a2fc44958cad22f812d166f6756
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-22 17:28:24 +02:00
Jean-Paul Etienne 9acda0f695 tests: gen_isr_table: account for riscv32 architecture
Account for riscv32 SOCs supporting the riscv privileged architecture.

Change-Id: I8c26a2bcc2baded5db252896abe6e1b5ab052113
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-02-22 14:59:01 +00:00
Andrew Boie 9c48b54d65 tests: add timer monotonic test
k_cycle_get_32() needs to return a monotonically increasing value,
except in cases of 32-bit integer overflow. Enforce this with a
test case.

We also check that the number of cycles elapsed after sleeping for 1
second is at the expected value. This can help catch errors on platforms
that use different timer sources for the system clock and timestamps.

This test case adapted from some code provided by Sergey Arkhipov
when troubleshooting ZEP-1546.

Issue: ZEP-1546
Change-Id: If27fff026ea6de659f7b41b60ff26f4962b734d4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-21 22:31:07 +00:00
Anas Nashif fe118c4e95 license: replace APL2.0 license with SPDX
Some files made it through review process with full license header.

Change-Id: I2722b127c40b4b19500042c12e4fde85a165bae9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-20 16:59:46 +00:00
Kumar Gala d3d2fab1ba boards: Add panther & panther_ss to sanity
Change-Id: I08345fb1063a4ba38095fca6512c5b7eb3e96da8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-02-20 15:41:31 +00:00
Qiu Peiyang 34b53f181f tests: add zephyr uart driver api test case
This commit verifies the following uart driver apis:
	uart_irq_callback_set()
	uart_irq_rx_enable()
	uart_irq_rx_disable()
	uart_irq_rx_ready()
	uart_irq_tx_enable()
	uart_irq_tx_disable()
	uart_irq_tx_ready()
	uart_fifo_fill()
	uart_fifo_read()
	uart_irq_update()
	uart_poll_in()
	uart_poll_out()

Change-Id: I9be9341aee4357f86a2bc49f19733fb84273e89c
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-20 13:42:47 +00:00
Andrew Boie e08d07c97d kernel: add flexibility to k_cycle_get_32() definition
Some arches may want to define this as an inline function, or
define in core arch code instead of timer driver code.
Unfortunately, this means we need to remove from the footprint
tests, but this is not typically a large function.

Issue: ZEP-1546
Change-Id: Ic0d7a33507da855995838f4703d872cd613a2ca2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-16 19:27:59 +00:00
Chuck Jordan 674db4df9a test: repair test_tickless for ARC because _tsc_read is now present
A _tsc_read has been added for ARC targets.
This test can use that when ARC.

See ZEP-1413

Change-Id: Ib63aecbe9f3eb2b97ad1086fc79b57e8f0774fca
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2017-02-16 04:56:50 +00:00
Benjamin Walsh d2654d3143 tests/kernel/common: add test to verify same tick timeout expiry order
Timeouts, when expiring on the same tick, should be handled in the same
order they were queued.

Change-Id: I23a8e971a47ca056b32b8b48fe179d481bae27c0
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-16 04:56:26 +00:00
Benjamin Walsh 4e0d690f24 tests: add tests for SYS_DLIST/SLIST_ITERATE_FROM()
Change-Id: I52dc6fa081be588f627670543ca9e2022d74bc37
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-16 04:56:23 +00:00
Flavio Santes 057f31e7e9 net/mqtt: Remove length computations for some msg fields
Currently, for the following MQTT msg fields:

- client_id
- will_topic
- user_name
- topic

their length is computed inside the routine that receives the MQTT msg.

Although this simplifies development, also imposes one restriction:
data must be null-terminated. Sometimes, data is received from other
sources and not generated by the application, so the null-terminated
constraint may be considered problematic for the user.

This patch removes the assumption that string fields are null-terminated.
Current data structures are already prepared to handle this case, so no
API change is required.

Change-Id: I5a147a5b21e0da49541cbe62baac363c8737cd3e
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-02-15 12:20:08 +02:00
Anas Nashif b62fbccce1 tests: gen_isr_table: disable for cortex-m0
Change-Id: Ic4c3ee2d319e60af166786b856384ee421526b81
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-15 00:05:14 -08:00
Anas Nashif 7ac0fd7aed tests: filter out tinytile, it is the same as arduino 101
Change-Id: Ifef85247e6bdb4e6a1de8f5d0fc8cf3c935bd280
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-14 23:22:58 -08:00
Andrew Boie 5c335ce55f tests: gen_isr_table: actually run the IRQ
So far, only implemented on ARM.
It's not possible to do this on Nios II and RISC-V.

Change-Id: I84c8d99cd163dff46de4bc4a7ae40768daf8e4ce
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-15 04:49:18 +00:00
Anas Nashif 15a6598691 Merge "Merge remote-tracking branch 'origin/core'" 2017-02-15 04:33:25 +00:00
Jithu Joseph b0f2e3ef14 tests: kernel: import obj_tracing test to unified kernel
obj_tracing test from legacy modified to use unified APIs
directly.

Jira: ZEP-932

Change-Id: Ib5d300334e527b842668be076c94c40b65d7cbe4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-15 01:08:34 +00:00
Sharron LIU bceabf6a4f tests: kernel: remove unsupported tests
Remove tests that assert due to invocation from ISR which is not supported.

Change-Id: Ib2313b8f75db0140aa475281bd76ba0414d6a481
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-14 06:45:40 +00:00
Jithu Joseph 4462509ea7 spi_test: fix variable type mismatches
This was reported by ISSM compiler.

Jira: ZEP-1179

Change-Id: Ib97ed8da830126c9fbfa2269c8b2327d2f1be2f4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-14 02:13:53 +00:00
Jithu Joseph ecba9dee51 test_mpool_api: fix variable type mismatches
This was reported by ISSM compiler.

Jira: ZEP-1179

Change-Id: I5700ff6b374815325fa858cfd11f8938c82d8337
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-14 02:13:52 +00:00
Andrew Boie da7864e727 REVERTME: tests: crypto: disable on Xtensa
Tinycrypt's definition of 'bool' does not work properly with
Xtensa's XCC compiler.

Issue: ZEP-1722
Change-Id: Id71b5f1bcf738c83e672b64a592a68751758dbc9
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:53:24 -08:00
Mazen NEIFER 4713575cb1 tests: Introduced new config option to add extra stack size for tests.
This option is added in order to support Xtensa, which needs more stack than
other architecture. This allows having a centralized way to change stack
requirements for all tests.
This extra stack size is eaqual to 0 for most architectures, except Xtensa
which requires additional 768 bytes for each stack.

Change-Id: Ie5dcae1dfd29018d36ef35dae22dc4c1a2ecdc14
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 11:39:03 -08:00
Andrew Boie 555c60631a REVERTME: tests: stackprot: disable on xtensa
Issue: ZEP-1702
Change-Id: Id8606e2c72bf21e236a13f48839516626929c171
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:03 -08:00
Andrew Boie 46c7275831 REVERTME: disable xip test on xtensa
https://jira.zephyrproject.org/browse/ZEP-1676

Change-Id: I5570031479de5b1d1859876c9155bd1fd70664a1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:01 -08:00
Mazen NEIFER 8e3b86fe0a Xtensa port: Connect Xtensa timer to tick IRQ in legacy test_context.
The test will also need to increase the stack to run correctly for Xtensa cores.

Change-Id: If94f12a941dc8eccf879558bdebdc7ccb2d047f1
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER daf28fa339 Xtensa port: Fixed tests/kernel/context to compile with Xtensa internal timer.
Change-Id: I4293adf23b7d46851747e3bcdd41b4a09e8fff05
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Qiu Peiyang 0c87784c84 tests/gpio: fix test GPIO_INT_EDGE bug
When test GPIO_INT_EDGE, there is no code to skip GPIO_INT_LEVEL
and jump to the end of the function. So GPIO_INT_LEVEL will
always be checked (Besides, it't always true), even if it's
testing GPIO_INT_EDGE, which will cause GPIO_INT_EDGE cases fail.

Add a goto statement for GPIO_INT_EDGE to skip GPIO_INT_LEVEL.

Jira: ZEP-1685

Change-Id: I10ce21c04c49f34aafdc2cd2f60f3e5377d6f1f5
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-12 01:04:09 +00:00
Qiu Peiyang bc2faf3737 tests/pwm: enable PWM case to work on D2000 board
This test case uses PWM0 port to test PWM on Quark Se.
However PWM0 port on Quark D2000 is initialized as tdo,
not PWM0 and disabling tdo will kill JTAG on D2000. So
use PWM1 and add PINMUX setting code to configure PIN_24
as PWM1 port, then the case will work on D2000 board.

Change-Id: Ib28d4750dac7396529388b781fb64bde048139d6
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-12 01:04:08 +00:00
jing wang 484f07cec7 tests: add zephyr adc driver api test case
the commit test below adc driver api with different resolutions
and modes
    adc_enable()
    adc_read()
    adc_disable()

move original adc test to adc_simple folder

Change-Id: I016b5e67a5d89fc8d5ae76f33799e5d3eb3e1cf8
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-02-12 00:33:59 +00:00
Qiu Peiyang 45c579a271 tests: add zephyr counter and timer api test
The commit verifies below aon counter and timer apis:
	counter_start()
	counter_read()
	counter_set_alarm()
	counter_get_pending_int()

Change-Id: Iaac9a224372ee1c1dd12a223ca222f4485957575
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-12 00:26:43 +00:00
Anas Nashif f16f6ec2df tests: pipe: remove unsupported tests
Remove tests that assert due to invocation from ISR which is not supported.

Change-Id: Idd2360847a467af6afdd9fbed8f87a620d9ed2f7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-10 23:03:58 -08:00
Anas Nashif bab5534ff6 tests: memory pool: remove unsupported tests
Change-Id: I467e9feb995db22b137038422aea9e1976166fc4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-10 23:03:55 -08:00
Anas Nashif 6e6e94bc77 tests: disable qemu_riscv32 on test_ecc_dh test [REVERT ME]
Change-Id: Iafba43007ab8daf1652b038bfbec184fe92b5ffc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-11 07:00:42 +00:00
Anas Nashif c5e000b2c8 tests: xip: pulpino does not support XIP
Change-Id: I806c3b4cc218d501285174249f173e59e748bea7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-11 07:00:41 +00:00
Anas Nashif 73a6da0763 tests: benchmarks: add new boards
Change-Id: I54eba3e63091b3bae15cda226735f412490ad77a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-11 07:00:40 +00:00
Baohong Liu 59b8af5395 tests: dma: update dma loop transfer app
Update the dma loop transfer sample app to use the new
dma api interfaces. This change is based on the api change
and the updated dma driver.

A RFC was posted recently on this.

Jira: ZEP-873

Change-Id: I289e2e08d4c775a833bf3d585d2706a903edd0bc
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-02-11 05:18:22 +00:00
Andrew Boie 122467e9ee tests: add test for gen_isr_table
This test is intended to verify that the SW ISR and vector tables
have been populated correctly.

Change-Id: Ic7f50c02dc0807d7ddefa710da67f818ff707ad6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-11 01:28:00 +00:00
Andrew Boie e7acd3224c arm: use gen_isr_tables mechanism for interrupts
This replaces the hard-coded vector table, as well as the
software ISR table created by the linker. Now both are generated
in build via script.

Issue: ZEP-1038, ZEP-1165
Change-Id: Ie6faaf8f7ea3a7a25ecb542f6cf7740836ad7da3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-11 01:27:58 +00:00
Jithu Joseph 720400372b misc: fix more variable type mismatches
These were reported by ISSM compiler.

Jira: ZEP-1179

Change-Id: Ic625749309773611c0c6ba2905e9420e98947dae
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-11 00:14:15 +00:00
Luiz Augusto von Dentz f7100f8092 tests/common: Add tests for sys_dlist_*
Change-Id: I95fbaf902968b71ce42fd6d04a10c41a0be4ff03
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-10 16:16:14 +00:00
Luiz Augusto von Dentz 2970771bbe tests/slist: Exercise CONTAINER macros
Change-Id: I8439febd605c50ee829f16bc68c53c7d5aebd5d2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-10 16:16:13 +00:00
Baohong Liu 00210386c6 tests: dma: update dma block transfer app
Update the dma block transfer sample app to use the new
dma api interfaces. This change is based on the api change
and the updated dma driver.

A RFC was posted recently on this.

Jira: ZEP-873

Change-Id: Icf3bec7260c2e499485b07a4a579956448a1a3fd
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2017-02-10 02:18:17 +00:00
Benjamin Walsh acece24eac tests/kernel/poll: verify .signaled is set correctly
Change-Id: I19b39d09c198ef7fee7d92d2d5847bd064057b61
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-09 23:54:27 +00:00
Benjamin Walsh 5bbd683b9b test/kernel/poll: fix putting wrong .signaled to 0
Change-Id: I7d7255fe85857ad3edb10070b585a6694d1d4b0b
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-09 23:54:26 +00:00
Ravi kumar Veeramally 3bb2f3b29a net: tests: Unref net_buf using net_nbuf_unref
Using net_buf_unref() technically works but debugging the network buffer
allocations is more difficult if done like that.

Change-Id: Ieaa0978aa69e2f0baa924fe842ca1f116c348ef1
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-09 12:29:29 +02:00
Qiu Peiyang 8a119a4319 tests: add filesystem api test
This commit verifies below FS APIs:
	fs_open()
	fs_close()
	fs_read()
	fs_write()
	fs_truncate()
	fs_seek()
	fs_tell()
	fs_sync()
	fs_unlink()
	fs_mkdir()
	fs_opendir()
	fs_closedir()
	fs_readdir()
	fs_stat()
	fs_statvfs()

Change-Id: I1a48b9e960b62a1c4986cc577f658199da7a28cd
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-02-08 13:25:35 +00:00
jing wang 4e5fa0ede2 tests: add systhreads test case
this commit check the priority of 2 system threads - main and idle

Change-Id: Ie57e7fdab3d15c0b69d85ed6282bfa6aa04133b4
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-02-08 13:22:49 +00:00
Anas Nashif 31f01f8ed6 Merge "Merge net branch into master" 2017-02-08 12:03:09 +00:00
Johan Hedberg 79883c9834 Merge bluetooth branch into master
- Use k_poll to consolidate all TX threads into a single one
 - Reuse HCI command buffers for storing their response
 - Improvements to SDP client support
 - New "volatile subscription" flag to GATT API
 - Various smaller fixes & cleanups here and there

----------------------------------------------------------------
Arkadiusz Lichwa (8):
      Bluetooth: SDP: Get ProtocolDescriptorList attribute internals
      Bluetooth: shell: Add SDP client support
      Bluetooth: uuid: Fix assigned UDP uuid value
      Bluetooth: SDP: Add API to get ProfileDescriptorList attribute
      Bluetooth: shell: Add getting ProfileDescriptorList attribute
      Bluetooth: SDP: Add API to get SupportedFeature attribute
      Bluetooth: shell: Use SupportedFeature attribute API
      Bluetooth: shell: Add support to retrieve A2SRC record

Arun Jagadish (2):
      Bluetooth: AVDTP: Remove buffer pool
      Bluetooth: AVDTP: Add AVDTP Discover Function Definition

Carles Cufi (1):
      Bluetooth: hci_core: Use nRF5x FICR address

Jaganath Kanakkassery (2):
      Bluetooth: RFCOMM: Fix session timer during acl disc
      Bluetooth: RFCOMM: Use common tx pool for control packets

Johan Hedberg (15):
      Bluetooth: Fix trivial coding style issue
      Bluetooth: Fix checking for invalid public address
      Bluetooth: Fix using correct variable type for interrupt mask
      Bluetooth: Fix buffer leak when HCI driver send() fails
      Bluetooth: drivers/h4: Add support for discarding certain events
      Bluetooth: Add convenience macros for common header sizes
      Bluetooth: Kconfig: Merge headroom reserve variables into a single one
      Bluetooth: Controller: Redesign response buffer allocation for commands
      Bluetooth: Reuse HCI command buffers for the command response
      Bluetooth: conn: Use delayed work for LE connection timeout
      Bluetooth: Merge bt_conn TX threads into a single one with k_poll
      Bluetooth: Merge HCI command and connection TX threads
      Bluetooth: samples: Add missing README.rst files
      Bluetooth: Controller: Use LL_ASSERT instead of BT_ASSERT
      Bluetooth: Fix incorrect checks for command buffer user data

Jonathan Gelie (3):
      Bluetooth: GATT: introduce volatile subscription flag
      Bluetooth: GATT: set subscribe value to zero for unsubscription
      Bluetooth: GATT: fixing unsubscription

Luiz Augusto von Dentz (1):
      Bluetooth: GATT: Fix not removing subscriptions safely

Sathish Narasimman (5):
      Bluetooth: HFP HF: Service level connection completed
      Bluetooth: HFP HF: Enable extended AG Error Result Code
      Bluetooth: HFP HF: Indicate disconnect to application
      Bluetooth: HFP HF: Disconnect rfcomm on SLC error
      Bluetooth: HFP HF: Remove unused variable 'buf'

Szymon Janc (5):
      Bluetooth: Use assert when getting net buf with K_FOREVER
      Bluetooth: Remove some dead code
      Bluetooth: L2CAP: Remove dead code
      Bluetooth: SDP: Make bt_sdp_create_pdu static
      Bluetooth: L2CAP: Make l2cap_br_send_conn_rsp return void

 drivers/bluetooth/hci/Kconfig                   |  13 +-
 drivers/bluetooth/hci/h4.c                      |  93 +++-
 drivers/bluetooth/hci/h5.c                      |  47 +-
 drivers/bluetooth/hci/spi.c                     |  13 +-
 drivers/bluetooth/nble/gatt.c                   |  76 +--
 include/bluetooth/buf.h                         |  13 +-
 include/bluetooth/gatt.h                        |  18 +-
 include/bluetooth/hci.h                         |   9 +-
 include/bluetooth/l2cap.h                       |  20 +-
 include/bluetooth/sdp.h                         |  51 ++-
 include/bluetooth/uuid.h                        |   2 +-
 samples/bluetooth/handsfree/README.rst          |  23 +
 samples/bluetooth/hci_uart/src/main.c           |  11 +-
 samples/bluetooth/hci_usb/src/main.c            |  11 +-
 samples/bluetooth/peripheral_sc_only/README.rst |  26 ++
 subsys/bluetooth/controller/hci/hci.c           | 153 ++++---
 subsys/bluetooth/controller/hci/hci_driver.c    |  23 +-
 subsys/bluetooth/controller/hci/hci_internal.h  |   2 +-
 subsys/bluetooth/controller/ll/ctrl.c           |   2 +-
 subsys/bluetooth/host/Kconfig                   |  10 +-
 subsys/bluetooth/host/at.c                      |   2 +-
 subsys/bluetooth/host/at.h                      |   3 +-
 subsys/bluetooth/host/avdtp.c                   |  81 +++-
 subsys/bluetooth/host/avdtp_internal.h          |   7 -
 subsys/bluetooth/host/conn.c                    | 178 ++++----
 subsys/bluetooth/host/conn_internal.h           |  15 +-
 subsys/bluetooth/host/gatt.c                    | 142 +++---
 subsys/bluetooth/host/hci_core.c                | 285 ++++++++----
 subsys/bluetooth/host/hci_core.h                |   6 +
 subsys/bluetooth/host/hci_ecc.c                 |   6 +-
 subsys/bluetooth/host/hci_raw.c                 |  12 +
 subsys/bluetooth/host/hfp_hf.c                  |  50 +-
 subsys/bluetooth/host/l2cap.c                   |  35 --
 subsys/bluetooth/host/l2cap_br.c                |  49 +-
 subsys/bluetooth/host/l2cap_internal.h          |   7 +-
 subsys/bluetooth/host/rfcomm.c                  |  31 +-
 subsys/bluetooth/host/rfcomm_internal.h         |   5 +-
 subsys/bluetooth/host/sdp.c                     | 584 +++++++++++++++++++++++-
 tests/bluetooth/shell/src/main.c                | 172 +++++++
 39 files changed, 1700 insertions(+), 586 deletions(-)
 create mode 100644 samples/bluetooth/handsfree/README.rst
 create mode 100644 samples/bluetooth/peripheral_sc_only/README.rst

Change-Id: I7589dbad8b97477c72d1b856121593bcf6d11339
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-08 13:03:20 +02:00
Ravi kumar Veeramally 58ba1d834e net: nbuf: Fix net_nbuf_compact() API
Current API description of net_nbuf_compact() is not very clear.
The first parameter needs to be the first net_buf in the chain.

The changes to this API are needed in order to clarify following
use cases:
1) User provides fragment that is not first of the chain and compact is
successfully done. In this case there is no free space in fragment list
after the input fragment. But there might be empty space in previous
fragments. So fragment chain is not completely compacted.

2) What if input fragment has been deleted and api returns the same
buf?

So this commit simplifies the API behavior. Now net_nbuf_compact()
expects the first parameter to be either TX or RX net_buf and then it
compacts it. It fails only if the input fragment is a data fragment.

Change-Id: I9e02dfcb6f3f2e2998826522a25ec207850a8056
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-08 10:12:36 +02:00
Ravi kumar Veeramally 999338ea94 net: nbuf: Remove unused net_nbuf_push() API
The net_nbuf_push() API is not used by anyone. Semantics are not
clear and following patch requires changes to push api, so removing
this API for now. If needed this can be re-introduced later.

Change-Id: I1d669c861590aa9bc80cc1ccb08144bd6020dac5
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-08 10:12:36 +02:00
Ravi kumar Veeramally 70f7922cee net: tests: 15.4: Increase max data size and fix config option
Test with max data in order to test the fragmentation code better.

Change-Id: I301a96eae1dd637f0291354120389c2bd7575695
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-08 10:12:35 +02:00
Jukka Rissanen bd3908b2a9 net: nbuf: Add timeout to net_buf getters
This commit changes the net_buf getter functions in nbuf.h
by adding a timeout parameter. These function prototypes
are changed to accept a timeout parameter.
	net_nbuf_get_rx()
	net_nbuf_get_tx()
	net_nbuf_get_data()
	net_nbuf_get_reserve_rx()
	net_nbuf_get_reserve_tx()
	net_nbuf_get_reserve_data()
	net_nbuf_copy()
	net_nbuf_copy_all()
	net_nbuf_push()
	net_nbuf_append()
	net_nbuf_write()
	net_nbuf_insert()

Following convinience functions have not been changed
	net_nbuf_append_u8
	net_nbuf_append_be16
	net_nbuf_append_be32
	net_nbuf_insert_u8
	net_nbuf_insert_be16
	net_nbuf_insert_be32
	net_nbuf_write_u8
	net_nbuf_write_be16
	net_nbuf_write_be32
so they call the base function using K_FOREVER. Use the
base function if you want to have a timeout when net_buf
is allocated.

Change-Id: I20bb602ffb73069e5a02668fce60575141586c0f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-08 10:12:35 +02:00
Andrew Boie e67828ba20 tests: remove old ARM vector table test
This was ported to the new kernel, no need to keep the old one around.

Change-Id: I02d39c8e39843cee1862448296e9c1d0dfde75b9
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-07 19:52:09 +00:00
Arkadiusz Lichwa 9fff70dbe5 Bluetooth: shell: Add support to retrieve A2SRC record
Adds to BT shell app functionality to trigger to be found on remote
A2SRC UUID. Implements user callback to read resolved response data
and uses existing SDP client API to read attributes values.

> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 48
      Channel: 64 len 44 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 2 len 39
        Attribute bytes: 36
        Continuation state: 0
        Combined attribute bytes: 89
          Attribute list: [len 84] {position 0}
            Attribute: Service Record Handle (0x0000) [len 2]
              0x00010005
            Attribute: Service Class ID List (0x0001) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Audio Source (0x110a)
            Attribute: Protocol Descriptor List (0x0004) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  L2CAP (0x0100)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0019
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  AVDTP (0x0019)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0102
            Attribute: Browse Group List (0x0005) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Public Browse Root (0x1002)
            Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  Advanced Audio Distribution (0x110d)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0102
            Attribute: Unknown (0x0100) [len 2]
              Advanced Audio [len 15]
            Attribute: Unknown (0x0311) [len 2]
              0x0001
< ACL Data TX: Handle 77 flags 0x00 dlen 12
      L2CAP: Disconnection Request (0x06) ident 10 len 4
        Destination CID: 65

Change-Id: I8938d9eebda31f3d252ff49adc1a96abfcbc5751
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 658ea8cc4b Bluetooth: shell: Use SupportedFeature attribute API
BT shell app tries to retrieve supported features exposed by remote
HFPAG enabled SDP record.

Jira: ZEP-1112

Change-Id: Ic8e5e8bd7cdea822fcaea317e884233e3bf0b4f9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 4f8641990c Bluetooth: shell: Add getting ProfileDescriptorList attribute
Makes use ProfileDescriptorList atribute API to get remote Hands-Free
profile version.

Jira: ZEP-1112

Change-Id: I3752691057e15c3a9a681dd3277ac160096792e9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 7577a4ff7c Bluetooth: shell: Add SDP client support
Adds pool memory for storing SDP client query results and introduces
command allowing add HFPAG UUID to be resolved when connection to peer
is already set. When resolved data arrives, UUID callback handler
tries to identify RFCOMM protocol specific information, in this case
remote HFPAG Server Channel Number, stored in Protocol's Descriptor List
attribute data.

> HCI Event: Number of Completed Packets (0x13) plen
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 55
      Channel: 64 len 51 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 2 len 46
        Attribute bytes: 43
        Continuation state: 0
        Combined attribute bytes: 96
          Attribute list: [len 91] {position 0}
            Attribute: Service Record Handle (0x0000) [len 2]
              0x00010003
            Attribute: Service Class ID List (0x0001) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Handsfree Audio Gateway (0x111f)
              UUID (3) with 2 bytes [0 extra bits] len 3
                Generic Audio (0x1203)
            Attribute: Protocol Descriptor List (0x0004) [len 2]
              Sequence (6) with 3 bytes [8 extra bits] len 5
                UUID (3) with 2 bytes [0 extra bits] len 3
                  L2CAP (0x0100)
              Sequence (6) with 5 bytes [8 extra bits] len 7
                UUID (3) with 2 bytes [0 extra bits] len 3
                  RFCOMM (0x0003)
                Unsigned Integer (1) with 1 byte [0 extra bits] len 2
                  0x03
            Attribute: Browse Group List (0x0005) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Public Browse Root (0x1002)
            Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  Handsfree (0x111e)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0106
            Attribute: Unknown (0x0100) [len 2]
              Handsfree Gateway [len 18]
            Attribute: Unknown (0x0301) [len 2]
              0x01
            Attribute: Unknown (0x0311) [len 2]
              0x0027
< ACL Data TX: Handle 77 flags 0x00 dlen 12
      L2CAP: Disconnection Request (0x06) ident 5 len 4
        Destination CID: 64
        Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 12
      L2CAP: Disconnection Response (0x07) ident 5 len 4
        Destination CID: 64
        Source CID: 64

Jira: ZEP-1112

Change-Id: Ibda606fabe367ca3d0353f77c7093da8c4f175c8
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Sharron LIU de7435a73f tests: kernel: mem_heap: added api and concept tests
<kernel.h> APIs covered:
    k_malloc
    k_free
Concept TESTPOINTs extracted from
https://www.zephyrproject.org/doc/kernel/memory/heap.html#concepts

ZEP-1242

Change-Id: I39edc809119984585d78d6abbe33f5be707c5818
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-02-04 19:36:50 +00:00
jing wang 61e5438c51 tests: add zephyr i2c driver api test
the commit verify below i2c apis by sensor
GY271 or HMC58831
    i2c_configure()
    i2c_write()
    i2c_read()
    i2c_burst_write()
    i2c_burst_read()

Change-Id: I072a9897a45636613e811baa7ff79b57206e4130
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-02-04 19:31:31 +00:00
Jean-Paul Etienne c989f0b408 riscv32: timer: replace riscv_qemu_driver by the generic riscv_machine_driver
riscv defines the machine-mode timer registers that are implemented
by the all riscv SOCs that follow the riscv privileged architecture
specification.

The timer registers implemented in riscv-qemu follow this specification.
To account for future riscv SOCs, reimplement the riscv_qemu_driver by
the riscv_machine_driver.

Change-Id: I645b03c91b4e07d0f2609908decc27ba9b8240d4
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-02-03 19:20:52 +01:00
Jukka Rissanen cc8eb4144b tests: net: Add tests for network interface
Change-Id: I35f0b3f1794c65b08d32ca561b6189ee59a7a76c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:18 +02:00
Jukka Rissanen 3c95a56c2a tests: net: rpl: Fix unicast NS sending
If we send unicast NS, then the destination IPv6 address needs
to be in the neighbor cache, otherwise we have a NS sending loop.

Change-Id: I11e8f5d5740248024a0becc77055786cd2e32199
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Jukka Rissanen 6b069f1589 net: tests: Add unit tests for net_nbuf_compact()
The compact function was never really properly tested
but it is used by other routines that have unit tests.
This commit makes sure there is a special testing for
the buffer compact function.

Change-Id: I35c108fd8459a9482ccae68a51ffa28fb2e0ae99
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-03 15:59:17 +02:00
Ravi kumar Veeramally 2de8bd928a net: tests: Add unit tests for net_addr_ntop() utils function
Change-Id: I72ee5f6444d2e45de0ee7a3aa96884282d41b72d
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-03 15:59:14 +02:00
Ravi kumar Veeramally 10e5162fc2 net: tests: Add unit tests for net_addr_pton() utils function
Change-Id: Ib1e89ce3bb7eff5afe14394062ee6f53a28cc4e6
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-02-03 15:59:14 +02:00
Benjamin Walsh e440759dbb tests/kernel/poll: test object runtime init functions
Change-Id: I04eac2e5cf5e49ea92fd6195c94a25e783aab253
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-03 13:54:01 +00:00
Benjamin Walsh 31189d9ec8 tests/kernel/poll: verify tag is untouched by API
Change-Id: I56f0f0db64c20db40c26b197bba8f1e6bb80a499
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-03 13:53:59 +00:00
Jithu Joseph 1eba370efd tests: kernel: import pool/heap tests to unified kernel
Jira: ZEP-932

Change-Id: I4adf43f63db8dca7c252e40433f6ff0095dc1f26
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 05:19:46 +00:00
Jithu Joseph cacb2edfb7 tests: kernel: port mutex/priority inheritance test to unified
Jira: ZEP-932

Change-Id: I41728a1448998e32c9ad8217f132afbfafbae3d7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 05:19:46 +00:00
Jithu Joseph 10e36609b6 tests: kernel: import libs test to unified kernel
This tests access to standard libraries. Adapted
to use ZTEST.

Jira: ZEP-932

Change-Id: I3564bfa61221b2456323c1018402237b6129b5ca
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 05:19:45 +00:00
Anas Nashif 6ca73fb744 tests: legacy: resolve conflict with MON defined in HAL
Some header files were defining MON and causing a conflict, so call this
something unique and avoid future conflicts.

Change-Id: If9d2553a20b3afae50a09f4c0e10733ee1cdd58d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 04:50:10 +00:00
Jithu Joseph 9659fec761 tests: kernel: import errno test to unified
Jira: ZEP-932

Change-Id: I59b3d0aebc7df37c9b59e8bf1358d20500f24f57
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-02-03 03:21:05 +00:00
Jithu Joseph 5800f16484 tests: kernel: import floating point sharing tests to unified
This is the microkernel version of the FPU sharing test from legacy
modified to  use unified APIs directly.

Jira: ZEP-932

Change-Id: I133a1466ea75201a97c2f8b83c3586fea0a19447
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-03 03:20:32 +00:00
Benjamin Walsh ed536245f7 tests: add poll kernel test
Change-Id: I87af7c404b9c77fd82746e5bc2baf4df74d9380c
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-02 00:30:01 +00:00
Marcus Shawcroft 458e2ed133 libc/minimal: Fix definition of ssize_t
Each GCC target backend is at liberty to define its own SIZE_TYPE. GCC
uses this for various purposes, not lease it drives the machinery that
spits out format specifier diagnostics when format specifiers are
applied to objects with inappropriate type.  GCC exposes the current
definition of SIZE_TYPE via the preprocessor symbol __SIZE_TYPE__.
The GCC build processes also generates various standard library header
files that directyle expose stanard types in a form consistent with
the current configuration of GCC.  Conventionally standard library
build processes (for glibc and newlib) pick up the header files
generated by the GCC build.

In the minimal libc we have no such build process, we don't pick up
the header files that the GCC build process generated.  Instead we
define our own alternative header files and align them with GCC
manually.

The current definition of ssize_t in minimal libc is out of step with
GCC which means that any use of the %z[du] format modifier will issue
a diagnostic.

We replace the open coded architecture detection in minimal libc and
use GCCs __SIZE_TYPE__ directly.

Change-Id: I63b5e17bee4f4ab83d49e492e58efd3bafe76807
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>

tests: fs: Fix printf warning when using newlib

Current code uses %ld format specifier to print data of
type ssize_t. This causes type warnings when built with
newlib. The correct format specifier to be used for
ssize_t is %zd.

Change-Id: I02a3c628e3d6e8a36a09cd694220406d8faf1730
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-02-01 13:57:43 -08:00
Jithu Joseph b7180a4903 tests: benchmarks: put all benchmarks in the same folder
We ended up having "benchmark" and "benchmarks". This
fixes that.

Change-Id: I7ebc409e002e11f5bc9dc821310dd84f3982b8d4
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-31 21:36:46 +00:00
Anas Nashif 58ccb64a74 benchmarks: boot_time: Move to unified kernel
Right now works only on x86, filed bug to address all architectures
(ZEP-1414).

Change-Id: Iba53b3688b2b78a4189df0b50578070a8d2ac8b2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-31 19:26:04 +00:00
Jithu Joseph 01652bd876 tests: kernel: import irq_offload test from legacy
This test was not using any legacy APIs, so simply
removed legacy from conf and ini's.

Jira: ZEP-932

Change-Id: I5a4b475ac5056b6d6aa64baef6bda53f20d8548e
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-31 12:20:50 +00:00
Jithu Joseph b636625a2b tests: benchmark: sys_kernel: Porting to unified
This change ports tests/legacy/benchmark/sys_kernel stuff to
use unified APIs.

Change-Id: If6fbaa5586502205e9f4dc6e79ff1c1a1c1b8102
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-30 21:33:47 +00:00
Jithu Joseph 7c118882d2 tests: include: Move timestamp.h into common location
These were part of latency_measure benchmark, but was
used in all benchmarks.

legacy symbols in timestamp.h were replaced to unified
ones. Tick based checks have been replaced with ms based
checks in line with the new APIs.

Change-Id: I1d27310023be4cafbceccf50cb87d72b6681443d
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-30 21:33:47 +00:00
Kumar Gala 434fad045a arm: cmsis: Convert _ScbNmiPend to use direct CMSIS register access
Jira: ZEP-1568

Change-Id: I56231084baaec4f6232f1ef4ebabe4f3fdb5175c
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-30 11:02:38 -06:00
Anas Nashif 66417c0246 Merge "Merge net branch into master" 2017-01-29 04:31:39 +00:00
Johan Hedberg eb07178236 Bluetooth: samples: Use Kconfig DEVICE_NAME variable when possible
Instead of using a hard-coded string, make the sample use the Kconfig
variable for the device name.

Change-Id: Ib09f594e1cba221f9064318572bd90d38bd2733a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-28 08:43:41 +02:00
Johan Hedberg 4153b6ca1f Bluetooth: Kconfig: Make device name variable generic
Change BREDR_NAME to DEVICE_NAME so it can also be used as the LE
device name.

Change-Id: I9ef55d9dff098372d47d9d5754ad7a7163a65bc0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-28 08:43:41 +02:00
Sergio Rodriguez fdf9238382 tests: context: Verify for out of bounds array
The for loop could exit with a out of bounds (variable j) value for
the delayed_threads array, we verify for the variable value before
operating on the array

This issue was reported by Coverity

Coverity-CID: 160078

Change-Id: I6aa1cc325cc363be48cd72b2a58d0a55ec3854bc
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2017-01-27 18:57:27 +00:00
Andrei Emeltchenko 6043dddd4a net: Remove unused CONFIG_NET_IPV6_NO_DAD option
Option CONFIG_NET_IPV6_NO_DAD is not used anymore, clean project
configuration files.

Change-Id: I368e076d2f79f1d4bc86edee11ff5befe37362c8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-27 12:35:54 +02:00
Andrei Emeltchenko 7ab5d4f572 net: tests: Correct project file for route tests
Routing tests uses ND so do not disable it, otherwise tests might fail
if disabling ND supported.

Change-Id: Ie020de8dac4447931d1067f1ed781a72cf05e8af
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-27 12:35:54 +02:00
Tomasz Bursztyka 83ed3a29be net/ieee802154: Modify radio TX function signature
The cause for this change is TCP. Until now, the radio strategy driver
(ALOHA or CSMA) was providing the actual nbuf, and not the buffer
fragment, counting on the fact that the loop was using
net_buf_frag_del() which made so, iteration after iteration, buffer
framgent to be always buf->frags. The problem with this logic is loosing
the fragments that might be still referenced by TCP, in case the whole
buffer did not make it so TCP can retry later and so on.

Instead, TX now takes the nbuf and the actual frag to send. It could
have been working with just a pointer on the data, and the whole length
of the frame. But it has been avoided due to possible future devices,
that will be smarter and run CSMA directly in the hw, thus it will
require to access the whole buffer list through the nbuf.

Change-Id: I8d77b1e13b648c0ec3645cb2d55d1910d00381ea
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:53 +02:00
Andrei Emeltchenko 5794d80c10 net: Remove CONFIG_NET_IPV6_NO_ND config option
The option is no longer used so it can be removed.
Use CONFIG_NET_IPV6_ND option instead.

Change-Id: Ibaa3d3deb52b8b176e85f8b9e1d8c80c1026aea1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-27 12:35:53 +02:00
Ravi kumar Veeramally 538d8d4032 net: tests: Use lighter printk() instead of printf()
Use printk(), snprintk() instead of printf() and snprintf().
CONFIG_STDOUT_CONSOLE is anyway disabled by default so printf()
will not output anything without it.

Change-Id: I5899741df2e187dae7b4602d074e9b4cbb9952aa
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-01-27 12:35:51 +02:00
Ravi kumar Veeramally b80878496d net: tests: Fix invalid config option in 6lo tests
The debug config was incorrect.

Change-Id: Id32cbcfb809acc9e4ab202b401d25e41a7531c42
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-01-27 12:35:50 +02:00
David B. Kinder d5bab09db6 license: fix SPDX headings on new tests
We're using SPDX tags for Apache 2.0 licensing instead of the
Apache 2.0 boilerplate comment block.

Change-Id: I9e56f918ab4ed4d127dbe64538c9fa62886386a8
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-01-26 20:01:39 +00:00
Anas Nashif 0a3738019f pinmux: unify galileo pinmux driver
Remove dev driver and integrate it in the default pinmux driver.

Jira: ZEP-958
Change-Id: I55670240f8a21749d3a6ae22e300e16ba80a2fb6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-25 20:43:18 +00:00
Anas Nashif 42e1c9ca34 pinmux: make pinmux_dev the default pinmux driver for quark
Jira: ZEP-958
Change-Id: Ib6c528a103372d5084efa5ae8635803e2912e0dd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-25 20:43:18 +00:00
Qiu Peiyang 41ffe0240d tests/gpio: fix test GPIO_INT_LEVEL bug
According to include/gpio.h, GPIO_INT_LEVEL is 0,
which means the branch to test GPIO_INT_LEVEL is
always false and GPIO_INT_LEVEL cases will always
pass.

This patch also fixes another minor bug in main.c.

Coverity-CID: 160074

Change-Id: I1fefa978e65bf801f244b4c2960cb87a26b0829e
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-25 14:25:48 +00:00
Qiu Peiyang cbeac3e97d tests/gpio: don't call risk function
According to Coverity, rand() is a risk function.
So we use another method to generate random value.

Coverity-CID: 160070

Change-Id: Icb7e06cd43cb8bade6596cc37e9d04bfc59e1de7
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-25 14:25:03 +00:00
Anas Nashif 1f55c8916d ztest: use an aligned stack size
1000 stack size was causing issues on architectures requireing aligned
stacks.

Change-Id: I57c06ef7eb09067d0312c27daad5d1300e6f43c6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-24 23:42:41 +00:00
Jean-Paul Etienne 2d1fd2c947 tests: kernel: threads_customdata: increase STACK_SIZE to 512 for riscv32
In RISCV, stack always grows by a multiple of 16 bytes, even if we are saving
data of size < 16 bytes onto the stack.

Hence, for riscv32 architecture increase stack size to 512 for
threads_customdata, otherwise we experience stack overflow.

Change-Id: I805bc346b8a2c2f4ad6d0db622eb262290af942b
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-24 23:03:30 +00:00
Jean-Paul Etienne bc81926b9a tests: kernel: test_mpool_concept: increase STACK_SIZE to 1024 for riscv32
In RISCV, stack always grows by a multiple of 16 bytes, even if we are saving
data of size < 16 bytes onto the stack.

Hence, for riscv32 architecture a bigger stack size is required for
test_mpool_concept, otherwise we experience stack overflow.

Change-Id: I938aa511efcae66f0131fa1bc23bd68600421885
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-24 23:03:29 +00:00
Kumar Gala 3ac51cd82b tests: newlib: disable bluetooth for now
When trying to build with newlib we get:

hci_driver.c: In function 'hci_driver_open':
hci_driver.c:389:10:
error: format '%d' expects argument of type 'int', but argument 2 has
type 'uint32_t {aka long unsigned int}' [-Werror=format=]
   BT_ERR("Required RAM size: %d, supplied: %u.", err,
          ^

This is because we have different types for {u}int32_t between newlib
and mini-libc.  We have to decide how we are going to handle this going
forward.  Various options include use of PRIu32, making mini-libc match
newlib's types, disabling the -Werror=format, etc.

Change-Id: I5df8fa05dd7658e1f6b2eeb8fa84e3270f3dd208
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-24 14:33:43 +00:00
Sharron LIU 110d58c055 tests: kernel: mbox_api: fix uninit variable and unchecked value
"struct k_mbox_msg mmsg" should be initialized before using.
"int" value returned by k_mem_pool_alloc() should be checked.

Coverity-CID: 160083
Coverity-CID: 160470

Change-Id: I35714bf9d76723c5fdd8c2963bf76b42ae1b1867
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:39:58 +00:00
Sharron LIU d9a3c92b5b tests: kernel: mpool: fix assert side effect
assert should not contain "i++" which might work differently in a non-debug
build.

Coverity-CID: 160469

Change-Id: Id8fd50127dd93de1676b812ac0888c9ec2e1b5de
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:39:41 +00:00
Sharron LIU 41d805a235 tests: kernel: mpool: fix unchecked return value
"int" value returned by k_mem_pool_alloc() should be checked.

Coverity-CID: 160471

Change-Id: I7ec19147e7a51997fed890075b06eba30bef9126
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:39:09 +00:00
Andre Guedes 6f141a5576 quark_se: PM: Add multicore support
This patch changes Quark SE power drivers to support multicore scenarios
e.g. both LMT and ARC core are enabled and manage power.

Handling LPS states in multicore scenarios are dead simple because LPS
states are core-specific states. It means that putting the LMT core in
LPS doesn't affect the ARC core, and vice-versa. DEEP_SLEEP state, on
the other hand, affects both cores since it turns power off from the SoC
and both cores are shutdown. It means that if LMT puts the system in
DEEP_SLEEP, ARC core is shutdown even if it is busy handling some task.

In order to support the multicore scenario, this patch introduces the
SYS_POWER_STATE_DEEP_SLEEP_2 state to both ARC and x86 power drivers.

On ARC, this state works as following:
1) Save ARC execution context;
2) Raise a flag to inform the x86 core that ARC is ready to enter in
   DEEP_SLEEP;
3) Enter in the lowest core-specific power state, which in this case is
   LPSS.

On x86, DEEP_SLEEP_2 is very similar to DEEP_SLEEP. The difference relies
in the post_ops() which calls _arc_init() in order to start ARC core so
it can restore its context.

This patch also adds the test/power/multicore/ directory which provides
sample application to x86 and ARC cores in order to easily verify the
multicore support. In test/power/multicore/README.rst you can find more
details regarding the applications.

Jira: ZEP-1103

Change-Id: Ie28ba6d193ea0e58fca69d38f8d3c38ca259a9ef
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2017-01-24 13:36:55 +00:00
Sharron LIU cd35f06de8 tests: kernel: msgq: fix unused value
"ret" returned from k_msgq_put() should be checked.

Coverity-CID: 160084

Change-Id: I192db3a67ab9489e8338f6636d4c2a6935e98d74
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-24 13:36:15 +00:00
Benjamin Walsh ee659ae1a1 build: add _ASMLANGUAGE to all asm files
This avoids asm files from having to explicitly define the _ASMLANGUAGE
symbol themselves.

Change-Id: I71f5a169f75d7443a58a0365a41c55b20dae3029
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-24 13:34:51 +00:00
Benjamin Walsh ed240f2796 kernel/arch: streamline thread user options
The K_<thread option> flags/options avaialble to users were hidden in
the kernel private header files: move them to include/kernel.h to
publicize them.

Also, to avoid any future confusion, rename the k_thread.execution_flags
field to user_options.

Change-Id: I65a6fd5e9e78d4ccf783f3304b607a1e6956aeac
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-24 13:34:50 +00:00
Kumar Gala 098f28983f tests: arm_irq_vector_table: Use CMSIS NVIC APIs directly
Convert testcases to use the CMSIS NVIC APIs or direct NVIC register
access rather than the internal ones so we can remove them in the future.

Change-Id: I2a5a3eae713e66944cf105e7fffa603b88522681
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:55 -06:00
Maureen Helm 06bd605da3 tests: Update spi driver test for mcux
Jira: ZEP-1374
Change-Id: Ibd66df42919d085666cfd7e98bea5c808d8d54e0
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-23 15:15:54 -06:00
Kumar Gala 2e0c2aff97 arm: nvic: kill _NvicSwInterruptTrigger
_NvicSwInterruptTrigger is only utilized by a testcase for irq handling
on ARM-V7M.  Just put the code into the testcase so we dont need to
support an additional interface.

Change-Id: I763c63c32a7a52918250458351d08b8fa54069dd
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:52 -06:00
David B. Kinder 516e155bb5 tests: update to Apache 2.0 SPDX tags on new tests
Some new tests were added that had the Apache 2.0 boilerplate licensing
instead of the SPDX licensing tag.

Change-Id: I4bde8c9c6e7a6d44bceeffb6bbcff9f62d417648
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-01-21 01:21:21 +00:00
Jukka Rissanen 088289ec28 net: context: Add status to connect callback
It is useful that the user API can know whether the connection
was established properly or not. So this commit adds status
parameter to connect callback in net_context API.

The call to connect callback needs to be set properly in TCP
code. This commit does not fix the connect callback call which
is not properly done right now in net_context.c.

Change-Id: I284a60ddd658ceef9e65022e96591f467a936a09
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:21 +02:00
Jukka Rissanen ba026941a1 net: ipv6: Fix IPv6 prefix comparision
If the prefix length % 8 is not 0, then the remaining
bit length was calculated incorrectly and the prefixes
were claimed to match even though they might not be the
same.

Adding a test cases for testing this properly.

Coverity-CID: 157591

Change-Id: I9cb5a73d5cc211ec183176400fa5e2dfd209e2da
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:18 +02:00
Michael Scott 4aad767328 net: linkaddr: calculate linkaddr storage addr size via config
- Introduce NET_LINK_ADDR_MAX_LENGTH which is either 6 or 8
  depending on whether CONFIG_NET_L2_IEEE802154 is used
- Instead of being a placeholder single index array of uint8_t,
  let's use NET_LINK_ADDR_MAX_LENGTH to assign the size of the
  "addr" array field in the net_linkaddr_storage structure.
- Now that the "addr" field of net_linkaddr_storage contains the
  true size of the link address, we can remove "storage" field
  which was hard coded to 8 bytes (2 uint32_t's).
- Fix 2 references to the "storage" field of the net_linkaddr_storage
  structure.

Change-Id: I2ea12058280b289f65085964eb7d503d4fd260c2
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:16 +02:00
jing wang 64579bc490 tests: add threads customdata api test case with unified kernel
the commit cover basic customdata apis:

k_thread_custom_data_set()
k_thread_custom_data_get()

Change-Id: Ide27cfd59230303767414c7f827d6ad627989a6f
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-20 12:41:56 +00:00
jing wang 6ffe10f50f tests: add pipe test cases which use unified kernel
Add kernel pipe test cases which cover basic pipe apis usage
across thread and isr

Change-Id: I11899411b305535297f2e25056678d5b7df8fb95
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-20 12:09:38 +00:00
jing wang e49480d590 tests: add fifo/lifo test cases with unified kernel
Add fifo/fifo test cases with unified kernel, which cover
basic apis across differnt contexts - thread and isr

Change-Id: Icb61d3dcd564167b0bd70419c652e0b000869959
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-20 12:09:11 +00:00
Sharron LIU c570efd63b tests: kernel: added memory pool threadsafe test
TestPurpose: verify API thread safe in multi-threads environment.

Jira: ZEP-1210

Change-Id: I1ff8231db8ebcd5713d6083379d0ebfbdabeeee0
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:47 +00:00
Sharron LIU 6ec8c6ef14 tests: kernel: added memory pool configuration options test
TestPurpose: verify memory pool configuration options.
All TESTPOINTs extracted from kernel documentation.
https://www.zephyrproject.org/doc/kernel/memory/pools.html#configuration-options

Jira: ZEP-1210

Change-Id: Ia5379aabd60e490c4566def21eda600c4c1b08dd
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:46 +00:00
Sharron LIU 61c53373ee tests: kernel: added memory pool concept test
TestPurpose: verify memory pool concepts.
All TESTPOINTs extracted from kernel documentation.
https://www.zephyrproject.org/doc/kernel/memory/pools.html#concepts

ZEP-1210

Change-Id: I6250e4c26ddf361e74a76c23082cfdb376705560
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:45 +00:00
Sharron LIU 415e71e04c tests: kernel: added memory pool api test
TestPurpose: verify memory pool APIs.
All TESTPOINTs extracted from kernel-doc comments in <kernel.h>

ZEP-1210

Change-Id: I7dcc0638e7b9c4d6b5ffe282e4fe41ca520d003f
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 11:45:45 +00:00
Sharron LIU d7a9ac21ce tests: kernel: added memory slab threadsafe test
TestPurpose: verify API thread safe in multi-threads environment.
Thread safe test is explained with more details here:
https://gerrit.zephyrproject.org/r/#/c/9464/7/ test_mpool_threadsafe.c
Please comment if you think it necessary as an extensive kernel test.

Jira: ZEP-1209

Change-Id: I52a7ff393d72785622c047289e7d92286e131cc7
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 04:45:04 +00:00
Sharron LIU 9ebf3dc10c tests: kernel: added memory slab concept test
TestPurpose: verify memory pool concepts.
All TESTPOINTs extracted from kernel documentation.
https://www.zephyrproject.org/doc/kernel/memory/slabs.html#concepts

ZEP-1209

Change-Id: I95c6cd666212218b9928356f9439e67a2fcf9b73
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 04:44:04 +00:00
Sharron LIU 37402b4161 tests: kernel: added memory slab api test
TestPurpose: verify memory slab APIs.
All TESTPOINTs extracted from kernel-doc comments in <kernel.h>

ZEP-1209

Change-Id: I80bc85e96110e7106b3fc5883b982d71c6a7e50b
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 04:43:42 +00:00
Sharron LIU 3cb55002b2 tests: kernel: re-path mslab test
tests/kernel/mem_slab --> tests/kernel/mem_slab/test_mslab
For the purpose to hold other mslab test apps.

Jira: ZEP-1209

Change-Id: I4a72b02a0a5095bb7cfbf73396b6d003ea63f92e
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-01-20 12:28:31 +08:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Johan Hedberg eccf03265f Merge bluetooth branch into master
- New SPI HCI driver for ST BlueNRG modules
 - More memory optimizations through TX buffer pool consolidation
 - Refactoring to take advantage of new IS_ENABLED() macro
 - Fixes to LE L2CAP Credit-based Flow Control
 - Various smaller fixes & enhancements here and there

----------------------------------------------------------------
Arkadiusz Lichwa (2):
      Bluetooth: UUID: Fix format specifier in 128-UUID
      Bluetooth: ATT: Fix redundant sys_slist call

Arun Jagadish (1):
      Bluetooth: AVDTP: Added params to AVDTP Request structure

Carles Cufi (1):
      bluetooth: hci_core: Fix conn params validity check

Jaganath Kanakkassery (1):
      Bluetooth: RFCOMM: Implement Aggregate Flow Control

Johan Hedberg (21):
      Bluetooth: Consolidate most outgoing ACL TX buffers into a single pool
      Bluetooth: Use the controller bt_rand() whenever possible
      Bluetooth: Controller: Rename hci_le_rand to bt_rand
      Bluetooth: hci_uart: Remove redundant idle & ISR stack size values
      Bluetooth: Remove unused bt_hci_driver_unregister() API
      Bluetooth: Add missing documentation to HCI driver APIs
      Bluetooth: GATT: Fix missing connection address comparison
      Bluetooth: ATT: Add new error code from CSSv7
      Bluetooth: Prefer struct bt_le_conn_param over individual values
      Bluetooth: Add documentation for connection callbacks
      Bluetooth: Remove ACL details from BT_BUF_RX_SIZE
      Bluetooth: L2CAP: Remove RECV_RESERVE from BT_L2CAP_RX_MTU
      Bluetooth: Introduce a new connection parameter request callback
      Bluetooth: Take advantage of IS_ENABLED macro for BT_DBG
      Bluetooth: Add __printf_like annotation for bt_log
      Bluetooth: drivers/nble: Remove bogus BT_DBG manipulation
      Bluetooth: hci_core: Take advantage of IS_ENABLED whenever possible
      Bluetooth: conn: Take advantage of IS_ENABLED whenever possible
      Bluetooth: L2CAP: Take advantage of IS_ENABLED whenever possible
      Bluetooth: SMP: Take advantage of IS_ENABLED whenever possible
      Bluetooth: Don't select TinyCrypt RNG for combined builds

Lee Jones (5):
      pinmux/stm32l4: Add support for STM32L SPI1 and SPI3
      pinmux/nucleo_l476rg: Define pinmuxing for SPI1 and SPI3
      Bluetooth: Add HCI SPI driver
      Bluetooth: samples/beacon: Print message at start of sample
      Bluetooth: Kconfig: Specify stack size for Bluetooth SPI

Luiz Augusto von Dentz (4):
      Bluetooth: L2CAP: Fix using CONFIG_BLUETOOTH_RX_BUF_LEN as MTU
      Bluetooth: IPSP: Reuse buffer fragments instead of copying
      Bluetooth: L2CAP: Make sure state is correctly updated
      Bluetooth: L2CAP: Fix always using RX_BUF_COUNT as initial credits

Sathish Narasimman (1):
      Bluetooth: AT: Rename enum at_cmd_type elements

 drivers/bluetooth/hci/Kconfig                   |  81 +++
 drivers/bluetooth/hci/Makefile                  |   1 +
 drivers/bluetooth/hci/h4.c                      |   8 +-
 drivers/bluetooth/hci/h5.c                      |   8 +-
 drivers/bluetooth/hci/spi.c                     | 351 ++++++++++++
 drivers/bluetooth/nble/conn.c                   |   8 +-
 drivers/bluetooth/nble/gap.c                    |  13 +-
 drivers/bluetooth/nble/gatt.c                   |   8 +-
 drivers/bluetooth/nble/rpc_deserialize.c        |  27 +-
 drivers/bluetooth/nble/rpc_serialize.c          |   5 -
 drivers/bluetooth/nble/smp.c                    |   3 +-
 drivers/bluetooth/nble/uart.c                   |   6 +-
 drivers/bluetooth/nrf51_pm.c                    |   1 +
 .../pinmux/stm32/pinmux_board_nucleo_l476rg.c   |  12 +
 drivers/pinmux/stm32/pinmux_stm32l4x.h          |  10 +
 include/bluetooth/att.h                         |   1 +
 include/bluetooth/buf.h                         |   1 -
 include/bluetooth/conn.h                        |  81 ++-
 include/bluetooth/l2cap.h                       |   2 +
 include/bluetooth/log.h                         |  40 +-
 include/drivers/bluetooth/hci_driver.h          | 106 +++-
 samples/bluetooth/beacon/src/main.c             |   2 +
 samples/bluetooth/hci_uart/nrf5.conf            |   2 -
 samples/bluetooth/ipsp/src/main.c               |  35 +-
 subsys/bluetooth/controller/hal/nrf5/rand.c     |   2 +-
 subsys/bluetooth/controller/hal/rand.h          |   2 +-
 subsys/bluetooth/controller/hci/hci.c           |   4 +-
 subsys/bluetooth/controller/hci/hci_driver.c    |  18 +-
 subsys/bluetooth/controller/hci/hci_internal.h  |   1 -
 subsys/bluetooth/controller/ll/ctrl.c           |   1 +
 subsys/bluetooth/host/Kconfig                   |  63 ++-
 subsys/bluetooth/host/a2dp.c                    |   7 +-
 subsys/bluetooth/host/at.c                      |  38 +-
 subsys/bluetooth/host/at.h                      |  10 +-
 subsys/bluetooth/host/att.c                     |  65 +--
 subsys/bluetooth/host/att_internal.h            |   6 +
 subsys/bluetooth/host/avdtp.c                   |  24 +-
 subsys/bluetooth/host/avdtp_internal.h          |  10 +-
 subsys/bluetooth/host/conn.c                    | 157 +++---
 subsys/bluetooth/host/conn_internal.h           |   4 +-
 subsys/bluetooth/host/gatt.c                    |  12 +-
 subsys/bluetooth/host/hci_core.c                | 504 +++++++++---------
 subsys/bluetooth/host/hci_core.h                |   5 +-
 subsys/bluetooth/host/hci_ecc.c                 |  11 +-
 subsys/bluetooth/host/hci_raw.c                 |   8 +-
 subsys/bluetooth/host/hfp_hf.c                  |   6 +-
 subsys/bluetooth/host/keys.c                    |   6 +-
 subsys/bluetooth/host/keys.h                    |   4 -
 subsys/bluetooth/host/keys_br.c                 |   6 +-
 subsys/bluetooth/host/l2cap.c                   | 108 ++--
 subsys/bluetooth/host/l2cap_br.c                |  32 +-
 subsys/bluetooth/host/l2cap_internal.h          |   8 +-
 subsys/bluetooth/host/log.c                     |   2 -
 subsys/bluetooth/host/monitor.c                 |   1 -
 subsys/bluetooth/host/rfcomm.c                  | 148 ++++-
 subsys/bluetooth/host/rfcomm_internal.h         |  15 +
 subsys/bluetooth/host/sdp.c                     |   6 +-
 subsys/bluetooth/host/smp.c                     | 211 ++++----
 subsys/bluetooth/host/smp_null.c                |   7 +-
 subsys/bluetooth/host/storage.c                 |   1 +
 subsys/bluetooth/host/uuid.c                    |   2 +-
 tests/bluetooth/shell/arduino_101.conf          |   2 +-
 tests/bluetooth/shell/prj.conf                  |   2 +-
 63 files changed, 1479 insertions(+), 852 deletions(-)
 create mode 100644 drivers/bluetooth/hci/spi.c

Change-Id: Ic11028e1f02636a48d95cbe03735af37cea94e25
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-18 19:09:51 +02:00
Anas Nashif 566b3fa0a0 tests: footprint: set ARCH correctly and provide defaults
Change-Id: I57beaf70d3cf8f1ef4267f002d2e72df22b918b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:39 +00:00
Anas Nashif 9d0e6f08f2 tests: do not use RC_OK, use 0 instead
RC_OK is defined only in legacy.h

Change-Id: I760924285629e3fe567ca30755393ecc754f7c02
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 19:03:36 +00:00
Anas Nashif 92af5aecab ztest: enable coop/preempt configurations
Change-Id: I5688fca73155cbb341f766d84f2d240b7ec8d05e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-17 12:17:24 +00:00
Benjamin Walsh abaaf89d69 tests/context: fix Coverity warning about array overrun
Coverity was warning about an array overrun that should never happen.
Add an extra check to verify that is indeed the case.

Coverity issue 152017.

Change-Id: Ie6269acaa85387ba051dbff87b4bfaab860517a6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2017-01-17 11:49:23 +00:00
Johan Hedberg 767c92e176 Bluetooth: Consolidate most outgoing ACL TX buffers into a single pool
Having TX buffers split into numerous pools has the downside of
increased memory consumption. This patch takes the initial step to
consolidate these pools into a single one, saving about 248 bytes of
RAM for a basic configuration.

Change-Id: I449ba18b44a9a6af68e9a2c44f19a9286eb88b14
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-17 08:44:21 +02:00
Benjamin Walsh 7ddec7b471 tests: add test for k_timer_user_data_set/get()
Change-Id: I1baaa4d1a4c1626b3acdbeb4b0bfe58c9b8fff0c
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-01-14 13:06:01 +00:00
Jean-Paul Etienne d65dae20e3 tests: kernel: threads_scheduling: increased stack size to 512 for riscv32 architecture
Otherwise, not passing sanitycheck

Change-Id: I6dba149750a7d4266fd52851f7e0b139efdba210
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 20:00:00 +00:00
Jean-Paul Etienne 142e3cb0f3 tests: legacy: kernel: context: account for riscv32 architecture
Added TICK_IRQ definition for CONFIG_PULPINO_TIMER and
CONFIG_RISCV_QEMU_TIMER

skip definition of HAS_POWERSAVE_INSTRUCTION for
CONFIG_SOC_RISCV32_QEMU, since it does not provide
power saving instruction.

Otherwise, not passing sanitycheck.

Change-Id: I2faa823226cd76d129d2bc3db961c9b862aaf784
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:59:44 +00:00
Jean-Paul Etienne fa12f10196 tests: kernel: context: account for riscv32 architecture
Added TICK_IRQ definition for CONFIG_PULPINO_TIMER and
CONFIG_RISCV_QEMU_TIMER

skip definition of HAS_POWERSAVE_INSTRUCTION for
CONFIG_SOC_RISCV32_QEMU, since it does not provide
power saving instruction.

Otherwise, not passing sanitycheck.

Change-Id: I43a5c5112d694efdc14c5a0bcb4cafdc196d2680
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:59:30 +00:00
jing wang 9dcd848faa tests: add timer test case with unified kernel
the commit verify basic timer apis, including
K_TIMER_DEFINE
k_timer_init()
k_timer_start()
k_timer_stop()
k_timer_status_get()
k_timer_status_sync()
k_timer_remaining_get()

Change-Id: I15e25e00b46fcfefe0a7b68a0a4befa96f657ead
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-13 02:46:24 +00:00
Anas Nashif a1ae7f565b Merge "Merge arm branch into master" 2017-01-12 18:23:39 +00:00
jing wang ae2cf51591 tests: Add PWM driver api test
The commit verify below PWM apis
    pwm_pin_set_cycles()
    pwm_pin_set_usec

test PWM apis under always-on, half-on and alway-off modes

Change-Id: I2251be23ad9c443703dac44e138651a63d2d7211
Signed-off-by: jing wang <jing.j.wang@intel.com>
2017-01-12 15:54:16 +00:00
Marcus Shawcroft ef8200dfcd arm: Replace CONFIG_CPU_CORTEX_M3_M4 with CONFIG_ARMV7_M
Precursor patches have arranged that conditional compilation hanging
on CONFIG_CPU_CORTEX_M3_M4 provides support for ARMv7-M, rename the
config variable to reflect this.

Change-Id: Ifa56e3c1c04505d061b2af3aec9d8b9e55b5853d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2017-01-12 09:46:25 -06:00
Maureen Helm acca033468 pinmux: Merge ksdk pinmux dev into regular ksdk pinmux driver
Merges the ksdk pinmux dev driver into the regular ksdk pinmux driver,
which now exposes the public pinmux API. Removes the private ksdk pinmux
API and converts the frdm_k64f and hexiwear_k64 boards to use the public
pinmux API.

Jira: ZEP-958, ZEP-1432
Change-Id: Ie5f60b604133093050b9c596050cad776d7b7cb3
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-01-12 09:46:25 -06:00
Kumar Gala 76480636f9 tests/sensors_n_z.conf: fix duplicated setting of CONFIG options
A few CONFIG options got set twice in sensors_n_z.conf, remove the
duplicates as we get warnings associated with this:

warning: override: reassigning to symbol GPIO
warning: override: reassigning to symbol SENSOR
warning: override: reassigning to symbol SPI
warning: override: reassigning to symbol SYS_LOG_SENSOR_LEVEL

Change-Id: I7a723218db8e365bdb45c004e93bd2c4f55ab5ac
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-11 19:40:01 +00:00
Anas Nashif 2bc9d69981 build: abstract emulation and replace qemu goal with run
This will replace the current goal of 'make qemu' with 'make run' and
moves Qemu handling into its own file and into the boards instead of
being architecture specific.

We should be able to add new boards that support some other type of
emulation (by adding scripts/Makefile.<emu type>) and allow the board to
define their own options for the use type of emulation.

'make qemu' will still work, however it will be deprecated, starting
with this commit it is recommended to use 'make run'.

Jira: ZEP-359
Change-Id: I1cacd56b4ec09421a58cf5d010e22e9035214df6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-10 20:20:47 +00:00
Kumar Gala d19910f685 samples/tests: reduce ram & code size for failing tests on nRF5x boards
These samples/tests fail to build on some of the nRF5x platforms.  We
don't need Bluetooth enabled for these tests so we can reduce footprint
by turning it off.

Change-Id: I87e62a1d70f80d2bc22414d6a9e591e36ad9fa06
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-10 02:23:23 +00:00
Kumar Gala 0314a4e287 Bluetooth: remove arduino_101_ble from test_controller_dbg
RAM size has increased on arduino_101_ble which causes it to no longer
be able to build test_controller_dbg.

Change-Id: Iab8ed2857db23d048cfa6b04e2d1fea31efbb13c
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-09 20:56:11 +00:00
Benjamin Walsh f955476559 kernel/arch: optimize memory use of some thread fields
Some thread fields were 32-bit wide, when they are not even close to
using that full range of values. They are instead changed to 8-bit fields.

- prio can fit in one byte, limiting the priorities range to -128 to 127

- recursive scheduler locking can be limited to 255; a rollover results
  most probably from a logic error

- flags are split into execution flags and thread states; 8 bits is
  enough for each of them currently, with at worst two states and four
  flags to spare (on x86, on other archs, there are six flags to spare)

Doing this saves 8 bytes per stack. It also sets up an incoming
enhancement when checking if the current thread is preemptible on
interrupt exit.

Change-Id: Ieb5321a5b99f99173b0605dd4a193c3bc7ddabf4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2017-01-09 20:52:24 +00:00
Anas Nashif 70a2e138b7 kernel: add LEGACY_KERNEL option
Add global option for legacy configurations and enable by default for
backward compatibility. Disable option on tests and keep it on legacy
samples and tests.

Jira: ZEP-964
Change-Id: I0831e2aa74d438b1ac74eb762186cb220a504beb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-09 19:42:13 +00:00
Jithu Joseph 89f4bf7c7e subsys: disk: Refactor disk_access stuff into a directory
Disk IO functions are used by both FS and USB Mass Storage.
This patch refactors those from FS directory to a separate one.
In addition existing, config options were modified to make
stuff meaningful.

Jira: ZEP-1276

Change-Id: Ia2a2e18f3dbbbdb964c3dc0427d8138ad86134cd
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-08 20:58:05 +00:00
Anas Nashif f6e039062a kernel: remove dependency on CONFIG_NANO_TIMERS/TIMEOUTS
Remove legacy option and use SYS_CLOCK_EXISTS where appropriate.

Change-Id: I3d524ea2776e638683f0196c0cc342359d5d810f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 18:09:52 +00:00
Andy Ross a5b694fbbc net: tcp: Select correct source address for SYNACK packets
The source address for a TCP SYNACK must (obviously) be the same as
the destination address of the SYN that produced it.  But the existing
IP packet creation routines would simply fill in a default address
from the net_context struct, which is correct for *established*
connections, but for the listening socket is generally INADDR_ANY
(i.e. all zeroes) and will result in an arbitrary choice for source
address (e.g. a link-local address on the same interface) which can
easily be wrong.

So we need to pass the correct address all the way down from the SYN
packet handler code through the net_ipv*_create() packet creation
functions.  This requires lots of API plumbing, but relatively little
logic change.

Change-Id: Ic368f8cef6689f8a27cbafd5933a4964d5cc457e
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-01-06 08:21:15 -05:00
Qiu Peiyang a6aa60f502 tests/gpio: fix typo
Change-Id: Ic93d1e5dcb46455abd3ea2d7fe8790b2163c1c67
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-01-05 23:54:18 +00:00
Vinayak Chettimada 27353bb655 Bluetooth: Controller: Kconfig connection RSSI measurement
Add Kconfig configuration and conditional compilation of
RSSI measurement during a connection.

Change-id: I5a2f23f76a7cbbd9569d53d31899a472bf39d3ee
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada 08fcc44b8a Bluetooth: Controller: Kconfig Data Length Update feature
Add Kconfig configuration to conditionally enable Data
Length Update procedure support in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.

Change-id: I4515c0c7cf9aeb333a289397ae3c9bac04a08e4e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada b37e285c03 Bluetooth: Controller: Kconfig LE Ping feature
Add Kconfig configuration to conditionally enable LE Ping
feature in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.

Change-id: I5fbbdbe8f45ac01c9b0d7b11e002a0d1db4d272e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada 04794ba1c1 Bluetooth: Controller: add init test for BT 4.0 only controller
Add a test configuration to build a controller that
supports only Bluetooth v4.0 features.

This is copy of prj_controller.conf, but Kconfig defines
will be added in subsequent commits to conditionally
compile out feature not in Bluetooth v4.0 specification.

Also, added nrf52840_pca10056 and arduino_101_ble board
builds be tested.

Change-id: I36891bfc54cc36a8588c9b019de582e3193e8aa3
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada a591205045 Bluetooth: Controller: Kconfig radio ISR profiling
Add Kconfig configuration and conditional compilation of
radio ISR profiling.

Change-id: Ia80d6bc54810156be99b2e6a25327c30d0714697
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Johan Hedberg 63f71adc5f Bluetooth: Take advantage of new net_buf_add_mem() API
This helps simplify code that was previously combining net_buf_add()
with memcpy().

Change-Id: If44cf9cd651aba5e544e36567869f147468663eb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:16 +02:00
Genaro Saucedo Tejada 2382cb8fa3 sanity: prevent stack corruption at test_static_idt
Stack for fiber idtSpurFiber at tests/legacy/kernel/test_static_idt
for nanokernel is not big enough since printk parse context refactor
(commit 3ab6046), causing sanity check to fail with CONFIG_DEBUG=y.

Change-Id: Iddc74a2800163a22be985067ce828ac859ae4a24
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2017-01-05 02:03:27 +00:00
Andrew Boie 0f08bd8cf8 gpio_basic_api: fix format codes
Change-Id: I006a0c3efe24a6d41a488a466cba97e9bbd1c164
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-01-03 20:37:40 +00:00
Inaky Perez-Gonzalez 57eb17a8ca tests/kernel/stackprot: 'fatal fault' is not a failure
By default, when a 'fatal fault' message is seen in the output of any
testcase, it is consider an inmediate fatal condition and the test
case is aborted.

However, this testcase is provoking the situation to verify the
condition is caught. This, it shall NOT be considered a fatal fault
and the default overriden to allow it to proceed.

This was done in the legacy testcases and now is moved to this
testcase, ported from legacy.

Change-Id: Icac6cf55cae2ffd9b071e9dd1f35918b7b30de5e
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-01-03 19:30:54 +00:00
Genaro Saucedo Tejada e3029f719f sanity: prevent stack corruption at test_sema
Stack for task tStartTask at tests/legacy/kernel/test_sema/microkernel
is not big enough since unfied kernel was enabled by default for all
test (since commit c2de216).

Change-Id: I3332cd5e14ca384428834697a1841fa680a68b00
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2017-01-03 19:30:31 +00:00
Juro Bystricky 5ec3a7d04a test_thread_init.c: fix build error
Fix build error (picked by GCC 6.x):

    error: ‘stack_size’ defined but not used [-Werror=unused-const-variable=]

Change-Id: I402324fedaea9d0a10ee6533ba957ce18fa0fb83
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-03 19:29:02 +00:00
Anas Nashif 66cfcc26bc tests: introduce Makefile.test
To customise test builds and support test related features such as time
stamps and a boot banner, introduce a Makefile variant that is dedicated
to testing.

Initially we introduce a new config overlay that is used for all tests, in
this case we enable BOOT_BANNER and BUILD_TIMESTAMP. This will print the
current version and the date, useful when reporting bugs and also an
indicator that the system has booted before the test has started.

For example:

[QEMU] CPU: qemu32
***** BOOTING ZEPHYR OS v1.6.99 - BUILD: Dec 21 2016 19:57:13 *****
tc_start() - Test Nanokernel CPU and thread routines
Initializing nanokernel objects
...
..

Change-Id: I224318cdeb55a301964ea366dbc577e2e3a09175
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-03 17:48:44 +00:00
Tomasz Bursztyka a1aa08c288 net: ip: Improve logging by adding a dedicated sys_log level
Let's make net stack having its own level of debugging through sys_log.
It replaces NET_DEBUG by NET_LOG_ENABLED, which is then semantically
better: someone wanting to log the errors might want that not only for
debugging.

Along with it, CONFIG_NET_LOG_GLOBAL option is added, in order to enable
all available logging in network stack. It is disabled by default but
might be found useful when warning/errors need to be logged, so it is
then unnecessary to selectively enable by hand all CONFIG_NET_DEBUG_*
options.

It is possible, locally, to override CONFIG_SYS_LOG_NET_LEVEL by setting
the level one want to NET_SYS_LOG_LEVEL. This can be useful on samples
or tests.

Change-Id: I56a8f052340bc3a932229963cc69b39912093b88
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:20 +01:00
Tomasz Bursztyka 4869dc9786 net: tests: Add platforms whitelist to http header unit test
quark_d2000_crb does not build as ROM and RAM space are way too little
for it.

Change-Id: I1a5992dcd49f90fa6604cd8ab76db7e170be7cd4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:20 +01:00
Flavio Santes ac7300611c net: Restructure network protocols
This commit restructures the network protocols. Changes applied are:

- Move lib/iot/ to subsys/net/lib
- Move network protocol headers to include/net
- Move lib/iot/zoap/link-format.h to include/net/zoap_link_format.h
  and link-format.c to zoap_link_format.c
- Move tests/iot/ to tests/net/lib/
- Adapt sample code
- Adapt build system
- Modify doxygen paths

Change-Id: I37085fa4cc76a8a8e19a499ecb4e87b451120349
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2017-01-02 10:03:19 +01:00
Vinicius Costa Gomes c538bb6602 tests/zoap: Add test for payload size
Add a test for the available space for the payload, so the problem with
the payload length doesn't regresses.

Change-Id: Ifef541d8428947eb482729aa773a7e9ddd2b6f81
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-02 10:03:19 +01:00
Tomasz Bursztyka 0a1617365f net: buf: Change NET_BUF_DEBUG to NET_BUF_LOG and add a level option
It will be thus possible to enable only the error logging, or the other
sys_log levels.

Change-Id: I0c0ed789f7cfbb4811320e8f8249151288274873
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:17 +01:00
Tomasz Bursztyka 56f25b49a9 tests: net: Fix format issues
Fixes:
error: format '%u' expects argument of type 'unsigned int'

Change-Id: I02aaaea79150967d7831d89d0c05427bf2685708
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-02 10:03:17 +01:00
Anas Nashif 7297f5db88 shell: move shell to its own subsystem
This moves the shell component into its own subsys and groups all
related files and options into a single place.

Additionally, one Kconfig option will now be required to enable the
shell:

 CONFIG_CONSOLE_SHELL=y

The header files was also moved to include/shell/shell.h and can be now
referenced with

 #include <shell/shell.h>

instead of

 #include <misc/shell.h>

Updated documentation as well.

Change-Id: Iffbba4acfa05408055e9fd28dffa213451351f94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 19:35:11 +00:00
Anas Nashif fad7e2dd8d logging: move event_logger to subsys/logging
Jira: ZEP-1337
Change-Id: If1690e19a882cf53caaa3418ccabeb49c783f63d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 14:34:43 -05:00
jing wang b008914e42 tests: add gpio driver test case
the commit include 5 ztest cases, cover the basic gpio APIs
including callback relevant and pin read/write functions.
It proves workable on intel quark c1000 and
arduino 101 platform

Change-Id: Iab30aa841cfa440c1f773b5a8c5ce0d68346c353
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 16:24:26 +00:00
jing wang 3d99a0c878 tests: add driver aio comparator test case
the commit cover below apis by testing callback under RISE polarity
    *) aio_cmp_configure
    *) aio_cmd_disabel

Change-Id: Idc9ec3a2694950d0074b69d164ee2c1edac35c9a
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 16:24:25 +00:00
Anas Nashif 0dd774df10 tests: import stack protection testcase to unified
Change-Id: I5a867b7bfed56ebfe79b3f14f772c6ab7482d229
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 16:24:25 +00:00
jing wang e23b0ab49f tests: add zephyr thread lifecycle test case with unified kernel
this commit cover zephyr thread lifecycle relavant apis testing
k_thread_spawn
k_current_get
k_thread_abort
k_thread_cancel
k_thread_suspend
k_thread_resume

Change-Id: I99bff0dd803f6e68e165f3388a3be09425c0596c
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:06 +00:00
jing wang 333e8d985d tests: add zephyr message queue test case with unified kernel
the commit cover basic message queue api testing across contexts
and some typical scenario

Change-Id: I82bb0c6a5df9d4436f5a98f78d1ad989e32282c8
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:05 +00:00
jing wang 3d20b9dad6 tests: add sem test cases which use unified kernel
add semaphore test case which cover basic sema apis
across thread/thread and thread/isr contexts.

Change-Id: I2041969fcdc70a4dfc95438f067fbef8ebb31b19
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:04 +00:00
jing wang 7553b4688b tests: add mutex api test cases which use unified kernel
add unified kernel mutext test cases which covere basic
mutex apis under different conditions - timeout,
no_wait, forever

Change-Id: Iaab5bba80a6eebd89bfe675352d67b27024ad7bb
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:03 +00:00
jing wang 3b03060579 tests: add stack test cases which use unified kernel
add stack test cases which cover basic api usage across
threads and thread/isr.

Change-Id: I1f42fa1139899c932a14da18753b93972f561bc8
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:03 +00:00
Jithu Joseph fb20912cb5 tests: kernel: test_slab: Porting memory map tests to unified
In unified kernel, memory maps are renamed as memory slabs.
This change ports tests/legacy/kernel/test_map stuff to
use unified APIs.

Change-Id: Ibf4d60fb53e45a119e6828a09f2638ee7def76b7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:02 +00:00
Sergio Rodriguez 5fbb695a01 tests: kernel: test_critical: Porting legacy tests to unified kernel
This is the port of the legacy/kernel/test_critical test case to
the unified kernel, and to use the ztest framework

Change-Id: I10834cbb51446b4a12fc680c0b65438d550f4d85
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:00 +00:00
Sergio Rodriguez a6a1360b24 tests: kernel: test_context: Porting legacy tests to unified kernel
This is the port of the legacy/kernel/test_context test case to
the unified kernel

Change-Id: I344ac240eb3b48042477f8875115fdc3fca1154a
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:16:00 +00:00
jing wang b10ab24c02 tests: add threads scheduling test case with unified kernel
this commit cover thread scheduling relevant apis

k_current_get()
k_sched_lock()
k_sched_unlock()
k_yield()
k_sleep()
k_wakeup()
k_busy_wait()
k_sched_time_slice_set()

Change-Id: Ie449db3dda910bc1bafc0b5a04633f284e7f1dc3
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 15:15:59 +00:00
Anas Nashif 1d3b16a74a tests: remove redundant test_ from test names
Change-Id: Ieeb2c44b2891b3cf451d9445b8959b1f338d731e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:46:50 +00:00
jing wang d15523f223 tests: Add watchdog timer test case
The commit cover Interrupt Reset mode and Reset mode by 2 test cases.
They can't be tested in one shot, but need test separately.
api converage:
    wdt_enable()
    wdt_disable()
    wdt_set_config()
    wdt_get_config()

Change-Id: I44b20cfe97d860e8b25b2cab76f9d9398cfd8e69
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:29 +00:00
jing wang ed754ecf6d tests: add rtc driver test case
the test include 2 ztest cases, verfy below apis:
    rtc_enable()
    rtc_disable()
    rtc_read()
    rtc_set_config()
    rtc_set_alarm()
    rtc_get_pending_int()

Change-Id: Ifca2541312c5ec8d450803f1b6e4f5064098e7fe
Signed-off-by: jing wang <jing.j.wang@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:28 +00:00
LIU, Sharron 638066757f tests: kernel: added test_thread_init
This test case is under test set "lifecycle" against
https://www.zephyrproject.org/doc/kernel_v2/threads/lifecycle.html

Change-Id: I0d43c1a1798411c786efc45d76e6fd7c024c47dd
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:28 +00:00
Sharron LIU 67af6f8844 tests: kernel: added test_workq_api
Change-Id: Iaadba1a720130a496a83c245c7da4b95dff168fd
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:27 +00:00
LIU, Sharron 6afbd387bf tests: kernel: added mbox api test
tested APIs:
K_MBOX_DEFINE
k_mbox_init
k_mbox_put
k_mbox_async_put
k_mbox_get
k_mbox_data_get
k_mbox_data_block_get

Change-Id: I73e1bd27a69b23fb5b8a856ce092fb651066a6c6
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 13:09:27 +00:00
Szymon Janc ad8eee2788 Bluetooth: shell: Fix br-discovery help message
Timeout should be passed as decimal.

Change-Id: I9f772b918e33eded8e0328e655e83cca74166595
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-24 08:42:15 +02:00
Szymon Janc 17ea315e20 Bluetooth: shell: Add option to specify BR/EDR discovery length
This allows to specify length of discovery from command line.

Change-Id: I3ad80e74b5cdc263e549ce309b75c1f5c117b653
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-24 08:42:15 +02:00
Baohong Liu 83a388e6c8 tests: spi: correct a spi buffer length issue
Make the buffer length for tx and rx are the same for
spi_transceive API call. QMSI only supports equal length.
This is clearly specifed in spi header file.

Also correct some coding style issues.

Change-Id: Ifd34683e8813dae9b692ad453176a93cb3848427
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-22 01:20:42 +00:00
Benjamin Walsh a1622472c3 drivers: hp206 driver does not need 2000 ticks/s frequency
From code inspection, the driver always took timeouts in milliseconds.
The only sub-ms wait uses k_busy_wait(), which has microseconds
granularity, but its granularity does not depend on the system clock
tick rate.

Change-Id: If48363fd1fbeeb8e5ff0f0f2ca86e671d63bc571
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-21 19:50:06 +00:00
Flavio Santes d8083e92ab arch/arc, usb, ztest: Add the ARG_UNUSED macro
Add the ARG_UNUSED macro to avoid compiler warnings.

Change-Id: Ie07f52e742bdb93fb35301bd50cce3865f229623
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-21 12:54:54 +00:00
jing wang 208fc48d81 tests: add zephyr alerts test case
the commit cover alert send and receive with 4 types -
DEFAULT, IGNORE, PENDING, CONSUMED which across thread and isr
context.

Change-Id: I41dae9ba2dc980bcd768f1220f55b5492bc8ae37
Signed-off-by: jing wang <jing.j.wang@intel.com>
2016-12-21 01:56:19 +00:00
Anas Nashif d3578bb2fc tests: GDB server only works on qemu_x86 now
Change-Id: Ie5ebb9d1be22cbb7c7cc3b54688cc957e49e786e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 15:48:51 -05:00
Anas Nashif 7e86380e63 tests: add gdb server test
Change-Id: If15b34ea24b68ea6527fc51c953451b656a10cf5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 14:59:35 -05:00
Anas Nashif 569f0b4105 debug: move debug features from misc to subsys/debug
Change-Id: I446be0202325cf3cead7ce3024ca2047e3f7660d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:40 +00:00
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Anas Nashif cfbe9b05a1 kernel: rename NANOKERNEL_TICKLESS_IDLE_SUPPORTED
rename NANOKERNEL_TICKLESS_IDLE_SUPPORTED to
TICKLESS_IDLE_SUPPORTED and remove nanokernel occurances in Kconfig
files.

Make TICKLESS_IDLE depend on hardware that supports it.

Change-Id: I6a2e4fb0f7cf4b45475b48e71823ea089ee98759
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:35 +00:00
Flavio Santes a73a5bc41e tests/tcp: Initialize buffer to NULL
This commit initializes some net_buf variables to NULL to solve the
issue reported by Coverity: "Memory illegal accesses (UNINIT)".

Coverity-CID: 157610
Coverity-CID: 157611
Coverity-CID: 157612
Coverity-CID: 157617
Coverity-CID: 157619
Coverity-CID: 157620
Coverity-CID: 157622
Coverity-CID: 157624
Coverity-CID: 157626
Coverity-CID: 157627
Coverity-CID: 157628

Change-Id: I98a1ea5db4c169f69e3fa3d5de4c0ed7fdf1820a
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-16 19:14:53 +01:00
Flavio Santes db04f43931 tests/iot/http: Initialize parser struct
This commit fixes the issues reported by Coverity:
	Declaring variable "parser" without initializer

Coverity-CID: 157613
Coverity-CID: 157614
Coverity-CID: 157615
Coverity-CID: 157616
Coverity-CID: 157618

Change-Id: Ib4ac2a663852fed3e40ce86af237d05b87f03a50
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-16 19:14:52 +01:00
Johan Hedberg 1c9da665c3 Bluetooth: Remove unnecessary runtime kernel object initialization
There are static initializer macros available for most kernel objects
which we should use whenever possible.

Change-Id: I496f4d05d26801eddd21fae53bdd4fcdc3246fe3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-16 10:27:48 +02:00
Anas Nashif fe958df4dd libc: rework libc selection and reduce Kconfigs
Moved all libc Kconfigs to where the code is and remove the default
Kconfig for selecting the minimal libc. Minimal libc is now the default
if nothing else is configured in.

Removed the options for extended libc, this obviously was restricting
features in the minimal libc without a good reason, most of the
functions are available directly when using newlib, so there is no
reason why we need to restrict those in minimal libc.

Jira: ZEP-1440
Change-Id: If0a3adf4314e2ebdf0e139dee3eb4f47ce07aa89
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 22:31:28 +00:00
Anas Nashif 6ce672d753 net: remove unused variable pkt1
Change-Id: I987765a6020b7d5b5ff8fd1213dfc4b9a13cdf7f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:33:02 +00:00
Anas Nashif 200c4031dd net: remove unused variable dis
Change-Id: Iec80bd13532b17d36fbe1b3d07f31b8f481859d9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:32:52 +00:00
Tomasz Bursztyka ca4ac62611 net: tests: Remove unused variables from dhcpv4 unit test
Fixes this:
error: ‘zero_addr’ defined but not used [-Werror=unused-const-variable=]
...

Change-Id: I5b0baf597e62f3206e15638a63e129503b76b048
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 14:34:16 +01:00
Julien Delayen 176d184fb8 power: Add ARC core suspend and resume support
When going into DEEP_SLEEP mode, the ARC core now saves
its context. This includes:
- All core registers
- Stack pointer
- Program counter (restored by jumping to the restore code)

The arc reset code now checks if the GPS0 bit 2 is set.
This is similar to the behavior of the x86 core done by
the QMSI bootloader which is setting GPS0 bit 1 in order
to call the restore path instead of cold boot path.

The sample has been adapted in order to support the ARC.

Jira: ZEP-1222

Change-Id: I375f03b16b8a5fd1f07ead55cf7e4947d6290c9f
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:33 +00:00
Johan Hedberg d659bb020e net: buf: Remove redundant user_data_size from buffers
Since the user data size is now stored in the pool there's very little
value in storing it as well per-buffer.

Change-Id: I17a99123b232423c52a2179b4eccd813728d51b1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:17 +02:00
Johan Hedberg 71c7c01819 net: buf: Remove the need for net_buf_pool_init()
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.

Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:02 +02:00
Johan Hedberg 45bc46d42e net: buf: Introduce net_buf_destroy() wrapper
This is only for use with custom destroy callbacks, so that the
application gets isolated away from the details of how exactly the
buffers are managed. This opens up the possibility of switching away
from k_fifo to potentially better solutions, such as k_lifo.

Change-Id: I0d8322fdec3500d8ae060ae471b9448aeaa4572a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 08:45:05 +02:00
Genaro Saucedo Tejada 1589f2ccdd sanity: filter the build-all test for ethernet
Ethernet build-all test was not being filtered base on RAM size so
build step LINK was failing with "region `RAM' overflowed by 192
bytes" error when running daily sanitycheck.

Added filter so this test is not attempted for boards with smaller
RAM such as quark_d2000_crb, which was causing daily build failure

Change-Id: I4ed3bef4f1c78e83890331db34fb1f2b2b066414
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-12-14 17:25:10 +00:00
Anas Nashif 418058a123 kernel: remove NANOKERNEL and MICROKERNEL configs
Those are legacy and not needed anymore.

Change-Id: I8113114fd60880b3f538612db7702f6129af0a06
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-14 13:45:52 +00:00
Marcus Shawcroft 954baea90b random: Restructure RANDOM Kconfig
Restructure the RANDOM Kconfig to match the structure used in other
drivers with a single top level menu.  Move the true random number
generators to appear first in the menu, with pseudo generators at the
bottom.  Do not present pseudo generators if a true random generator
is presented.

This change implies that tests, samples and applications that require
the random driver interface must now select CONFIG_RANDOM_GENERATOR.

In order for tests and samples to build (and run) on platforms that
have no random driver it remains necessary to select
the CONFIG_TEST_RANDOM_GENERATOR.

Note that CONFIG_TEST_RANDOM_GENERATOR retains its original purpose of
enabling a random driver that delivers non random numbers for the
purpose of testing only.

Change-Id: I2e28e44b4adf800e64a885aefe36a52da8aa455a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00:00
Marcus Shawcroft fe8d044d9a tests: Remove unnecessary CONFIG_TEST_RANDOM_GENERATOR
Remove CONFIG_TEST_RANDOM_GENERATOR from each test and sample where it
is not required.

Change-Id: I949f8e93c2cb1881622a5e48efeb87c43122a170
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00:00
Johan Hedberg c3e08c8fea net: buf: Redesigned pool & buffer allocation API
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".

This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:

	NET_BUF_POOL_DEFINE(pool_name, ...);

Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.

This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.

Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-13 21:41:53 +00:00
Anas Nashif 0859df1eca kernel: disable MDEF by default
Disable MDEF option and set it only in legacy projects.

Change-Id: I2e1f011eb1f876af929140e36f71f0efb5e955c1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-12 20:25:07 +00:00
Marcus Shawcroft 409b754a15 Remove application calls to sys_rand32_init.
The random driver, if enabled, is initialized by the kernel
initialization function.  There is no need for applications or tests
to re-initialize the driver.

Change-Id: Ib4712dda937a7a83a8079c8aa662cec03c5416f8
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-11 11:18:18 +00:00
Maureen Helm 4a1c31a790 k64: Change the default pinmux driver to the ksdk one
Stop using the specific k64 pinmux driver by default and start using the
more generic ksdk pinmux driver instead.

Jira: ZEP-1393
Change-Id: Id65b59518c386e6ba33cfa5c4c5bd541664d2b41
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-12-10 21:14:12 +00:00
Jaganath Kanakkassery 77753193d9 Bluetooth: shell: Add support for RFCOMM Disconnect
This is used to disconnect a dlc.

Syntax:
>br-rfcomm-disconnect

Change-Id: I8f345d9fbb1f1f84bfb1f697322d9a87ff531797
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-12-09 06:53:14 +00:00
Johan Hedberg a4b6b2417d Bluetooth: Switch from printf to printk functions
There's now snprintk available that's more light-weight on the stack
than snprintf.

Change-Id: I6b3e4409703ca92fe6b8f4146ff47c490ab826cb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-09 08:18:24 +02:00
Johan Hedberg c899cd0d12 printk: Add APIs to print into strings instead of default output
These correspond to the libc snprintf and vsnprintf APIs.

Change-Id: If3944972ed95934a4967756593bb2932c3359b72
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-05 20:08:40 +00:00
Anas Nashif 918740d15b tests: net: exclude quark_d2000_crb
Not enough memory on this device with 8K of SRAM

Change-Id: I359cce806098cac7e0e2a9e00ce40c91bc535c5b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-05 16:44:46 +00:00
Anas Nashif 70f9244db7 Merge "Merge net branch into master" 2016-12-05 15:56:26 +00:00
Benjamin Walsh 0e2451e3a0 tests: increase stack size on test_errno
The stacks are overrun on ARM.

Change-Id: Ic5f1555b138a732e409c92cff716278b33dfce5d
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-02 22:57:30 +00:00
Anas Nashif bf83460725 tests: ipm: change init level from NANOKERNEL to POST_KERNEL
Change-Id: I86bbf50525018148689be9362c191d00324c595c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 15:52:35 +00:00
Vincenzo Frascino fc1071d91e tests/kernel: verify RUNTIME_NMI at runtime
This patch introduces a test that verifies the behavior of
CONFIG_RUNTIME_NMI at runtime.

The test is meant to be only for ARM Cortex-M targets.

Change-Id: I805a88e67fe47d396ac9e29e1275e5452a4b8a36
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-02 14:03:28 +00:00
Flavio Santes a1dc687b5d iot/http: Add test-case for HTTP header fields
This commit adds the following routines:

- test_invalid_header_content
- test_invalid_header_content
- test_invalid_header_field
- test_invalid_header_field
- test_preserve_data
- test_parse_url
- test_method_str
- test_header_nread_value
- test_double_content_length_error
- test_chunked_content_length_error
- test_header_cr_no_lf_error
- test_invalid_header_field_token_error
- test_invalid_header_field_content_error
- test_double_content_length_error
- test_chunked_content_length_error
- test_header_cr_no_lf_error
- test_invalid_header_field_token_error
- test_invalid_header_field_content_error

Origin:
https://github.com/nodejs/http-parser/releases/tag/v2.7.1
https://github.com/nodejs/http-parser/archive/v2.7.1.tar.gz

This patch reformats some http_parser files to reduce checkpatch
warnings.

See:
	https://gitlab.com/santes/http_parser/tree/refactoring1
Commit:
	c58dd8350fdf6ead0807ba37107b19f58e4f434c

Furthermore, method_str overflow test was updated to avoid compiler
warnings on some platforms.

Before:
	Line 627: http_method_str(1337)
After:
	Line 627: http_method_str(127)

Jira: ZEP-346
Jira: ZEP-776

Change-Id: If6163f59de21186f22f4f02d8c44f43ddbf9b59b
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen 3eaec41ab8 net: Moved net/ to subsys/net
* Moved networking code into subsys/net.
* Renamed net/yaip to net/ip at the same time.
* Fixed the tests/net to compile
* Fixed the Makefiles and Kconfig files in subsys/net
  to use the new location of the IP stack

Change-Id: Ie45d9e8cb45a93fefdf969b20a81e3b1d3c16355
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:20 +02:00
Jukka Rissanen 368ef49331 tests: net: ipv6: Add test for neighbor advertisement
Check that we change the ll address in neighbor cache
properly when receiving NA.

Change-Id: Ib0373751abebdfe1c5e83fd38ec91b9587797e32
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:18 +02:00
Jukka Rissanen e2a4432e85 tests: net: ipv6: Wrong IP address was added to cache
Peer address is used when sending NS so that it is added
properly to neighbor cache.

Change-Id: I51c2e236a0b137f7ab086a782f3baced13aa3ee3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:18 +02:00
Jukka Rissanen bd9f9e7cde tests: net: ipv6: Fix prefix test
Also disable prefix lifetime overflow test as it does not work
properly.

Change-Id: I54c8716f6a6d4f5bec76b0a61fe0e18e983924f4
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:18 +02:00
Anas Nashif 47b27514a3 test: net: remove nano/micro tests
Change-Id: I57898f5d9f050a2301504a3df43feb2bd1e6d4fc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 12:41:17 +02:00
Anas Nashif 3d97803c02 tests: net: remove qemu.pid file and bad filters
Change-Id: I26ef207fdebab674a89d54efeb3f4a1a3c4258f6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 12:41:17 +02:00
Jukka Rissanen 68ea9377e6 net: Make native IP stack the default
As the native IP stack is now the default, there is no need
for corresponding Kconfig option.

Change-Id: I08e4992f540f928a2b7378e8803e634e38725348
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Jukka Rissanen 6b43821f20 net: Remove legacy Contiki based uIP stack
This commit removes the legacy Contiki based uIP stack.
The new native IP stack must be used after this commit.

The commit also removes following things:
- legacy cc2520 driver
- legacy ethernet drivers
- legacy IP stack samples

and changes these things:
- disabled tests that only work for legacy IP stack
- select new IP stack by default
- enable random number generator by default as it is needed
  by the new IP stack

Change-Id: I1229f9960a4c6654e9ccc6dac14a7efb9394e45d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Ravi kumar Veeramally 72c71e8310 net: ieee802154: Add offset based reassembly feature
Current reassembly of 802.15.4 packets works only if fragments are
in correct order. But as per RFC 6282 reassembly should be based on
offset parameter in fragmentation header.

Change-Id: Icdcb10b9aa8f5837063b0201a64f8eb050c75681
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen f4be98b4bb tests: net: Change the tag of network tests to net
There were different tags defined in testcase.ini files for
networking tests. Unify these and change the tag to "net"
in all networking tests. This makes it easy to execute
all network tests via sanitycheck.

Change-Id: I8ce7ccf8cccca35234602e37f6568db0b986d181
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Jukka Rissanen d048b5c9d1 tests: buf: Do not depend on IP stack
The net_buf tests were including net_ip.h which requires some
extra config options to be usable when the new native IP stack
is used. In order to avoid this dependency, define struct in6_addr
locally in the source file.

Change-Id: Iafe0d2b5b507665baaed23f5e2c55a9d9a300d47
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:11 +02:00
Tomasz Bursztyka a54d5607ad tests: ieee802154: Fix compilation error in fragment test
Which happens only when internal DEBUG is set to 1

Change-Id: I175943f32065ae81b1a4453dde40f36738c28084
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:09 +02:00
Leandro Pereira 6b9b9a6f75 net: tcp: Provide NET_TCP_FLAGS macro
Instead of having to write "NET_TCP_BUF(buf)->flags & NET_TCP_CTL"
every single time, provide a NET_TCP_FLAGS macro that expands to this
expression.

Change-Id: Ie876c538599fabae6b800a53613b6ad17dc45620
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:08 +02:00
Tomasz Bursztyka 85a8f8e6fa net: trickle: Using unified kernel API
Dropping legacy API. This commit also contains updated
unit tests in order to pass the test.

Change-Id: Ibc7426837e2f4f23bb5f3ed3719635c5c3d0ed0f
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:07 +02:00
Tomasz Bursztyka 06362ff5c6 tests: net: Using unified kernel API
Dropping legacy API.

Change-Id: Ife835e38fb03e909e89c3060771f42d1cfa12164
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:07 +02:00
Flavio Santes c55ca20ad4 iot/mqtt: Add support for frdm_k64f
This commit adds the frdm_k64f board to the testcase.ini while list.
It also updates the README file with the build instructions and
firmware version used in this test.

Change-Id: Ia0e989d483aede51aa53e7453bbd1c260223372d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:06 +02:00
Jukka Rissanen 1b58d970ca net: ipv6: Move unspecified address getter to ipv6.c
More logical place for net_ipv6_unspecified_address() is in ipv6.c
instead of net_if.c. Removing the net_if_ipv6_unspecified_addr()
variant as it is no longer needed.

Change-Id: Ib5b4f6748030a8bf50fb848a87eef2968e2bcbc8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:04 +02:00
Flavio Santes 88c160021c iot/mqtt: Add test app for the MQTT packet handling routines
The following routines are evaluated in this test case:

- mqtt_pack_connect
- mqtt_pack_disconnect
- mqtt_pack_publish
- mqtt_pack_subscribe
- mqtt_pack_suback
- mqtt_pack_pingreq
- mqtt_pack_pingresp
- mqtt_pack_puback
- mqtt_pack_pubcomp
- mqtt_pack_pubrec
- mqtt_pack_pubrel
- mqtt_pack_unsuback

- mqtt_unpack_connect
- mqtt_unpack_disconnect
- mqtt_unpack_pingreq
- mqtt_unpack_pingresp
- mqtt_unpack_puback
- mqtt_unpack_pubcomp
- mqtt_unpack_pubrec
- mqtt_unpack_pubrel
- mqtt_unpack_unsuback

Future patches will extend this test case to cover the whole MQTT
packet library.

Origin: Original

Jira: ZEP-870

Change-Id: I4fee403c24d1eb0428fb18b413763e28b6b726d1
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-02 12:41:03 +02:00
Tomasz Bursztyka b52f8f1fa1 tests: net: TCP Context needs to be listening before running accept
Change-Id: I433ddac41afcb055cd45e2e7fc4c26ed8c56e3c2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Tomasz Bursztyka 64e7dc2caa tests: net: Unified kernel is now default and only one
Adapting all unit tests so:

- main task's prj.mdef is already provided by unified kernel with a
default stack of 2kb.
- unified is the only kernel to be used now, removing unecessary kernel
type make option.
- removing all NANOKERNEL/MICROKERNEL related #ifdefs and so on.

Change-Id: I9b853dbd2aef971d355188cbf7fe2ececaaa80c1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:41:02 +02:00
Leandro Pereira ad1a9d088d net: tcp: Add better type safety for connection handlers
This creates a `struct net_conn_handle` that's only used as an opaque
pointer.  The purpose is to avoid assigning a void* to a void** in
connection registering/unregistering functions, avoiding a
previously-caught bug by issuing an incompatible pointer types warning:

	warning: passing argument 7 of 'net_tcp_register' from
		incompatible pointer type [-Wincompatible-pointer-types]

Suggested by Andy Ross in 5beec6.  This particular commit didn't catch
any bugs, but the one caught in 5beec6 wouldn't exist if this were in
place at the time.

Change-Id: I5c13fb4c5826adce6397feb7b400d36e426c4a87
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-12-02 12:41:02 +02:00
Jukka Rissanen c15b467d42 net: tests: Send IPv6 hop-by-hop option to IP stack
Added a test to send HBH option to IP stack. Currently
the test will always pass, activate some more debugging
to see what the IP stack is doing with the option.

Change-Id: Id0ab1590eb8216f5f67c4d43ce2e882186334198
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:01 +02:00
Jukka Rissanen dffafbd290 net: tests: Unit tests for RPL
Change-Id: I5c2c4dd4eb8a8af77bd0d8db06b09a25871893b3
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:00 +02:00
Jukka Rissanen cac9d1b3cf net: Add support for embedding extra data to routing entries
This can be used to store routing protocol specific data
into neighbor entry. By default no extra data is allocated.

Change-Id: Iabff0a1df676398a47b86adbc398c4f566dcc40a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:58 +02:00
Jukka Rissanen c38dd8870c tests: net: 6lo: Make sure no error in microkernel
Microkernel test for 6lo was giving error because the
prj.mdef file was refering to wrong function name.

Change-Id: I4197c509fb266a908eb03cc0bda34e39c66b229c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:57 +02:00
Tomasz Bursztyka 91c3f06e97 tests: net: Moving IEEE 802.15.4 fragmentation test in proper place
fragment is only about testing 15.4 6lo fragmentation, so let's put it
in dedicated tests/net/ieee802154/ directory.

Change-Id: Ib838600e571753ab976c74dac78ee774f628c2ab
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 593fc81bf4 tests: net: Multiple test will go inside ieee802154
So reordering files in order to put more specific tests in it.

Change-Id: I000bc5efb8442d02e9a50e1b85cb45e0bec12789
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 831bfcb048 net: ieee802154: Improve 6lo frag reassemble API
No reassembly logic is changed besides removing the final reassembled
pointer. Instead of requiring such pointer, let's just use the frag one.
Such changes will ease the usage of ieee802154_reassemble():
the given frag buffer, in case it finally got reassembled and thus
provided a NET_CONTINUE verdict, will directly be handled by net_core.

This makes things consistent as well with verdicts:
- in case of NET_OK, buf has been consumed and thus unrefed
- in case of NET_DROP, buf needs to be unrefed by caller
- in case of NET_CONTINUE, buf is updated with reassembled and
  decompressed data packet, up to net_core to handel it accordingly.

Change-Id: Ibd1588debd22a7f4571b36713dd46bf8b1d88329
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 34988043a4 net: ieee802154: Reverse 6lo fragmentation verdict
As soon as fragment is put into the cache and as long as it is not
identified to be the last one: let's return NET_OK to notifiy the
fragment has been consumed by ieee802154 L2.

That way, net_core will not try to interpret it - and fail - unnecessary
increasing the drop statistics.

On the contrary, once the buffer is fully reassemble, let's return
NET_CONTINUE in order to let net_core consume the buffer relevantly.

Change-Id: I715b687e451f4643656e122b0d119f114696340b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Tomasz Bursztyka 2887bbf7fc tests: ieee802154: Make the test ready to handle multi fragments buffer
Buffer sent by 802.15.4 L2 might have more than one fragment, thus
handling it properly.

Change-Id: I12fef8a9c5de56615c3a084c57f438e71b320fcf
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-02 12:40:56 +02:00
Vinicius Costa Gomes 86b1ef7b7b tests/zoap: Fix extra unref on net_buf fragments
Since "22e919872206b1d net: Adapt to new behavior of net_buf_frag_add"
net_buf_frag_add() takes onwership of the fragment, so this _unref()
after a net_buf_frag_add() is wrong.

Change-Id: I1559c2978cf8d800891d6e752478537fbee7c02b
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Vinicius Costa Gomes 3aa352e622 tests/zoap: Port observer tests to the native stack
This enables the tests for the observer feature to be run using the
native IP stack.

Change-Id: I325dcd1f5d9fffe3821eed1bd950a717e5f17b67
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:55 +02:00
Ravi kumar Veeramally 78502f1804 net: tests: Update DHCPv4 test results based on events
Earlier test results was updated as soon as test server ACK client
dhcpv4 request. But update results on IPv4 address add event on
interface.

Change-Id: I212309a4d1d2eae88f73470e00754db1d6fecda5
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:54 +02:00
Marcus Shawcroft f903cb3763 net: dhcpv4: Implement XID
RFC2131 requires that a client must choose XIDs in order to minimize
the chance of collision with another client.  Selection of a random
XID at boot is a valid approach. Adjust the XID representation from
array of bytes to the more convenient uint32_t representation,
initialize the XID to a random number and increment for each request.

Refactor the dhcp test case to generate response messages with the XID
from the received message.

Change-Id: I93f180e6aa02430f807e0a97186577dc956fb653
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-02 12:40:53 +02:00
Jukka Rissanen 7f4275ef52 iot/zoap: Temporarily disable block size transfer test
The test "Test block sized transfer" does not work with
new IP stack so disable it temporarily for new stack.
This needs to be fixed later.

Change-Id: Ie89dd101270ab9b8a9b056757de79cd3da009180
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:53 +02:00
Ravi kumar Veeramally d3b21f0171 net: tests: Add unit tests for net_nbuf_write/insert utilites
Change-Id: I4df5672777af2c27511465b72ea17b7b5e0c8e8f
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:53 +02:00
Anas Nashif e6bbc5003c net: do not depend on ARCH
Rename project configuration to be architecture independent and do not use ARCH
in Makefile.

Change-Id: Ic793751e3187bc74fd14cec929754d691b01a799
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-02 12:40:52 +02:00
Jukka Rissanen 1c3c26a1f9 net: tests: Add TCP unit tests
This provides only initial set of functionality tests
for TCP. More tests are to be written.

Change-Id: I157fed85f561523bf063732ce86eaae551c2d384
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:40:52 +02:00
Ravi kumar Veeramally c689fd6f1a net: Rename net_nbuf_write to net_nbuf_append
Current net_nbuf_write() api just appends data to last fragment. And
doesn't write data based on offset. That's why renaming this api.

New net_nbuf_write() apis based on offset will be coming soon.

Change-Id: Ie8e13e5f6091a279b62b6d8b0b3928a5187e75b0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-12-02 12:40:51 +02:00
Vinicius Costa Gomes dc45748d50 iot/zoap: Port to the native stack
This ports zoap to the native stack.

Just for reference, and totally not scientific, here are the numbers
using the old stack:

$ size outdir/qemu_x86/zephyr.elf
   text	   data	    bss	    dec	    hex	filename
  34657	  10316	  16916	  61889	   f1c1	outdir/qemu_x86/zephyr.elf

With yaip:

$ size outdir/qemu_x86/zephyr.elf
   text	   data	    bss	    dec	    hex	filename
  30575	   9148	   6164	  45887	   b33f	outdir/qemu_x86/zephyr.elf

Jira: ZEP-818

Change-Id: I7992a3e2af7d419081ee5a64d7cc2d49fb628ead
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-12-02 12:40:50 +02:00