Commit graph

41120 commits

Author SHA1 Message Date
Szymon Janc
8f800a8bfe Bluetooth: Use unified k_sem API for semaphores
Change-Id: I0099c837cc8ad67b8f927b2debd771acfe626eea
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-09 08:57:52 +02:00
Szymon Janc
8944c25c90 Bluetooth: Controller: Include zephyr.h instead of nanokernel.h
zephyr.h includes required kernel header depending on selected
configuration.

Change-Id: Ib72c4038637c303ee32e433706355299ae1b9a13
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-09 08:57:52 +02:00
Luiz Augusto von Dentz
3808ad0a96 Bluetooth: L2CAP: Limit segments to TX MPS
le_data buffers are no longer limited to the minimun of 23 bytes, instead
it uses CONFIG_BLUETOOTH_L2CAP_IN_MTU which means it can be bigger than
the MPS thus causing invalid data to be sent:

> ACL Data RX: Handle 64 flags 0x02 dlen 18
      LE L2CAP: LE Connection Request (0x14) ident 1 len 10
        PSM: 128 (0x0080)
        Source CID: 64
        MTU: 672
        MPS: 23
        Credits: 65535
< ACL Data TX: Handle 64 flags 0x00 dlen 18
      LE L2CAP: LE Connection Response (0x15) ident 1 len 10
        Destination CID: 64
        MTU: 230
        MPS: 65
        Credits: 4
        Result: Connection successful (0x0000)
< ACL Data TX: Handle 64 flags 0x00 dlen 27
< ACL Data TX: Handle 64 flags 0x01 dlen 2
      Channel: 64 len 25 [PSM 128 mode 0] {chan 0}
        3c 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff  <...............
        ff ff ff ff ff ff ff ff ff

JIRA: ZEP-1219

Change-Id: Id67f1faac8766c66aa24c7421d44112434666a10
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-09 08:57:52 +02:00
Szymon Janc
3317227437 Bluetooth: Remove workaround for Mynewt firmware bug
This is not needed for Zephyr controller build and should already
be fixed in Mynewt.

Change-Id: I39e81dc3e9b5fd5a3f5f823465527248625caf26
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-09 08:57:52 +02:00
Johan Hedberg
c1f47859e1 Bluetooth: doc: Move PICS documentation to right place
There's no point in having both a doc/bluetooth and a
doc/subsystems/bluetooth. Move the PICS documentation to the right
place and convert it to rst in the same go.

Change-Id: Iada1f19d0ed3fb3b374e7f708f175d53d797bd93
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-09 08:57:52 +02:00
Arun Jagadish
227b1d4643 Bluetooth: AVDTP: Set Profile Security Level to Medium
Setting AVDTP Profile Security to Medium

Change-Id: I93aa367ac5bfe4e8bfe08f25d0e7e9d65b891350
Signed-off-by: Arun Jagadish <arun.jagadish@intel.com>
2016-11-09 08:57:52 +02:00
Johan Hedberg
257ccbeece Bluetooth: doc: Update subsystem description
Add information about the controller support, raw HCI interface and
the new location in the source tree.

Change-Id: I6fab7f17e4a96b8217cd9de4f2437cfba8c06564
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-09 08:57:52 +02:00
Luiz Augusto von Dentz
4f39b4ceb1 Bluetooth: L2CAP: Fix regression causing credits not to be restored
Patch 8c118f8673 causes the wrong semaphore
to checked so receiving credits are never restored which caused the
channel to get stuck after all the credits are consumed.

JIRA: ZEP-1199

Change-Id: I9cd5474b3bcaafcb19d15613939ce30d07befe0a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-09 08:57:52 +02:00
Baohong Liu
621c1d6dbd boards: arduino_101: correct an error related to SPI CS
The right flag to enable GPIO as SPI CS is SPI_CS_GPIO.

Change-Id: I06fc5e7e44f9aa6bad5867462c6c069d545bb0b7
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-09 02:48:26 +00:00
Juro Bystricky
f3bf5abd52 newlib: add support for nano-formatted-io
If newlib is configured with --enable-newlib-nano-formatted-io,
floating-point support is split out of the formatted I/O code into
weak functions which are not linked by default. This leads to a smaller
code by about 16~20k when using newlib "printf" and/or "sscanf" but not
using floating point I/O.

Programs that need floating-point I/O support must explicitly request
linking of one or both of the floating-point functions:

    _printf_float or _scanf_float.

This can be done at link time using the -u option which can be passed
to either gcc or ld.

Implemented via new configuration options:
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF
    CONFIG_NEWLIB_LIBC_FLOAT_SCANF

Change-Id: I57f9d9f02e6d21d6011d14de7153b1d3ba6f6e32
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2016-11-09 02:47:43 +00:00
Jithu Joseph
cc9cdadeae samples: usb: Sample to demo USB Mass Storage support
Sample to put the device in USB mass storage mode via
config options.

Change-Id: Icaf4839d8e8ac0526d1b723adc87607d6b4df9d7
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:47 +00:00
Jithu Joseph
63b4e2134f usb: class: Add USB mass storage class support.
This patch implements USB Mass Storage device Class,
which allows the  Zephyr target Board to appear
as a USB drive to a host.

This code would invoke disk_read() /disk_write()
hooks which are to be provided by the storage
layer.

The Mass Storage protocol state machine is based on
mbed's implementation. We augment it by adding Zephyr's
USB transport and Storage APIs, and offload disk ops
to a fiber context rather than in the USB irq context.

origin: https://developer.mbed.org/users/mbed_official/code/USBDevice/file/01321bd6ff89/USBMSD

Jira: ZEP-233

Change-Id: I8199598c76da20ab20012d81dac7615f6a366303
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:46 +00:00
Jithu Joseph
7eab305593 usb: Add end-point stall APIs and flow control APIS
USB class drivers may need to offload some work from
upcall interrupt context to a background fiber. This
requires some way to defer taking more data from host
till the offloaded work completes. Two APIs are added to
achieve this.

Further USB class drivers sometimes need to set STALL condition
on end-points to signal errors to host.These too are
added.

Change-Id: Ic973522c3394e23d7f9c4c67affc0cd050afc20f
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:46 +00:00
Jithu Joseph
2fe288b4aa fs: expose generic ramdisk/flash disk access functions
This patch removes "FAT" from  files names, config names and
symbol names so as to avoid confusion, when other modules use
them in a more generic way.

Also flash_disk_access.c and ram_disk_access.c now exports generic
disk_access symbols as defined in include/disk_access.h rather
than FAT specific ones in fs/fat_diskio.h. Thus modules like
USB which need to use disk_access interface is not dependent
on symbols from ELMChan FAT module. Also fat_diskio.h
is removed.

Further the shim between ELM chan and Zephyr is modified as
per these changes.

Change-Id: Ifd80f14a629e467ee9c7a9aaff8a4896eed11982
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:45 +00:00
Jithu Joseph
383d9b757a include: Add a generic disk interface
Adds a disk interface which is independent
of filesystem specific symbols or headers.

Change-Id: I8c72fd3a9d12c5d9623721513fc66edc7bce0a5d
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-11-09 02:45:44 +00:00
Baohong Liu
6096e7866c drivers: spi: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I0424e8b1fee51df6fd3eb06ba6d99284a2e83393
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-09 02:40:32 +00:00
jing wang
2c311431fc tests: add a dma transfer test with different channel and burstlen
This TC cover dma transfer with different channel and burst length
It support 2 ways to execute
*) full-auto: by default, it run all sub test cases defined in array
   once flashing done and reset.
*) interactive: when CONFIG_CONFIG_CONSOLE_HANDLER_SHELL=y, it go into
   shell first, user can input test command one by one for debugging.

move original test under drivers/dma to test_loop_transfer/

Change-Id: I7e78b730592c80bf2c23b20c8b0eb65a9b353acd
Signed-off-by: jing wang <jing.j.wang@intel.com>
2016-11-09 02:38:57 +00:00
Benjamin Walsh
c7ba8b17e1 kernel: rename k_am_in_isr() to k_is_in_isr()
Change-Id: Ie312da34dbbfbeb2c76bbf38905d8f334da28b63
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 20:27:31 -05:00
Benjamin Walsh
3cc2ba9f9c kernel: add __ASSERT() for thread priorities
Verify the thread priorities are within the bounds when starting a new
thread and when changing the priority of a thread.

Change-Id: I007b3b249e4b80235b6439cbee44cad2f31973bb
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 20:27:31 -05:00
Benjamin Walsh
c13fad3bb8 kernel: add utility functions to compare thread priorities
Since lower-numbered thread priorities are higher, the code can be
misleading when comparing priorities, and often require the same type of
comments. Instead, use utility inline functions that does the
comparisons.

_is_prio_higher already existed, but add comparisons for "lower than",
"higher than or equal to" and "lower than or equal to".

Change-Id: I8b58fe9a3dd0eb70e224e970fe851a2575ad468b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 20:26:39 -05:00
Benjamin Walsh
8450c903be kernel: fix issues in idle thread
- Add missing irq_lock() before invoking power management.
- Only yield if the idle thread is a coop thread (in coop-only
  configurations).

Change-Id: I030795e782590b3023f1d7883bbd058da2c45f4f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 23:38:55 +00:00
Benjamin Walsh
fab8d92936 kernel: add K_IDLE_PRIO
Define the priority reserved for the idle thread rather than use
K_LOWEST_THREAD_PRIO.

Change-Id: I514296d774047fa1348249da8ee90a68b6aace17
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 23:38:48 +00:00
Benjamin Walsh
0d5f541052 samples: remove useless prj_unified.conf from kernel logger sample
Change-Id: I67c8afd4ba7b89953a1d4adb19febba2f0ae8165
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 23:38:41 +00:00
Benjamin Walsh
4e5b4c74af kernel_event_logger: fix _current.prio acces in __ASSERT()
_current is a pointer.

Change-Id: I8efbd1daca58b687732abec4d759f10a5dff8ef6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 23:38:34 +00:00
Benjamin Walsh
5986ec040b arc: fix race condition when returning from interrupt
A race condition would happend if a FIRQ interrupted a
return-from-interrupt from a RIRQ at the wrong moment: if a decision was
already taken which thread to context switch in and the FIRQ woke up
another thread of higher priority, the ready queue would be corrupted.

The solution is to lock interrupts at the moment the interrupt return
code starts looking at the kernel queues. Interrupts do not need to be
unlocked before exiting: the return-from-interrupt (rtie) instruction
will restore the correct interrupt locking state for the thread being
context switched in.

Change-Id: I777665c2faeca7b1f2a77ddd9ee2a520080bae88
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 22:50:14 +00:00
Andrew Boie
84a92048cf test_ipm: increase stack size
The main task uses stack-hungry() printf(), and the switch to the unified
kernel pushed the necessary space over the edge.

Change-Id: I7b64e7f09d91c5050ffe7fb18506ff24289169fc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-08 22:45:56 +00:00
Andrew Boie
9b0ec51098 arc: remove CONFIG_NANOKERNEL code
Change-Id: I1978c067d422aebb52d736ac747443a06bd437c3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-08 22:02:46 +00:00
Andrew Boie
ee95dd22a4 x86: remove CONFIG_NANOKERNEL references
Change-Id: I8c6ca9189dd09133162816675e33332d6e5a34b3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-08 22:02:45 +00:00
Dmitriy Korovkin
44af016810 tests: Add configuration for small frequency dividers for system clock
For systems that have both high base (CPU, bus, etc.) frequency and
small divider of the base frequency for system clock and this way,
do not allow 1 second period for the system clock, set the system
clock period to 0.1.

Change-Id: Iafb4604112d4adb8430f8bf57a5a31de3f6cf91d
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-11-08 21:34:31 +00:00
Dmitriy Korovkin
e0509bc79e unified/tests: Unlock the mutex exactly same time as it was locked
Since the mutex can not be unlocked if it is not locked, fix the test
and make sure that it unlocks the timer exactly same times as it locked
it before.

Change-Id: Ie29d308b789ed00f4fd3cf2faef3aa1f4bc89e3e
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-11-08 21:34:30 +00:00
Dmitriy Korovkin
6f357b60ff unified/kernel: Assert that mutex is not unlocked without previous locking
Add an assertion against unlocking mutex that is not locked.

Change-Id: I1032fb904e364015b486502c035529c8fe31de7a
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-11-08 21:34:29 +00:00
Iván Briano
f4764fc348 counter qmsi: Enable the driver to work on ARC
Jira: ZEP-1030

Change-Id: I3f5e26f399a163467ec8371802b7472d87416940
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-08 14:37:35 -02:00
Johan Hedberg
dad2a77e6b boards: Add support for Quark SE C1000_BLE
The Quark SE C1000 BLE Core is a nRF51822-QFAA, with 16kB of RAM and
256kB of flash. The configuration is otherwise similar to the Arduino
101 BLE, except that the UART RTS pin is the same as that used by
nrf51_pca10028.

Change-Id: I88cb18876bdde65abcf9a499894f70802046c824
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-08 15:00:00 +00:00
Baohong Liu
05bed1c663 drivers: pwm_qmsi: add type cast to prevent overflow
Add type cast to prevent overflow.

In the pwm driver function pwm_qmsi_get_cycles_per_sec(),
there is a multiplication which takes ticks_per_us (32 bit
unsigned integer) and USEC_PER_SEC. Practically, overflow
will not happen, since the sys clock is not that high. But,
it can trigger an overflow alarm by automatic tools.

Change-Id: I67e6f6a4763e62f6674fcdd364880d93829e739e
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-08 14:28:26 +00:00
Baohong Liu
9d89fa5ec5 drivers: rtc: Add delay to wait for new config to take effect
Add delay to wait for new configuration to take effect before
returning to API caller. It takes time for any change to rtc
configuration to take effect since rtc runs under a much slower
clock.

Of course, we do not have an equation for best wait time.
The value is based on the test results on arduino 101, minfield
and quark se c1000 devboard(some margin added).

Jira: ZEP-991

Change-Id: I0dcee3c5809963dcd418186b85e3473427a4d526
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-08 14:28:14 +00:00
jing wang
4ee0b6b589 tests: provide MACRO to easily wrap test function to shell command
usage is as below:

TC_CMD_DEFINE(test_func_1)
TC_CMD_DEFINE(test_func_2)

static const struct shell_cmd commands[] = {
		TC_CMD_ITEM(test_func_1),
		TC_CMD_ITEM(test_func_2),
		{ NULL, NULL }
};
SHELL_REGISTER("runtest", commands);

Change-Id: I4eab67113954f373d5a2cbfaa729be180fd31444
Signed-off-by: jing wang <jing.j.wang@intel.com>
2016-11-08 14:25:59 +00:00
Johan Hedberg
c1485fe2f8 boards: arduino_101: Set sensible default for SPI_0_CS_GPIO
The SPI_0_CS_GPIO and SPI_0_CS_GPIO_PIN values were defaulting to
something not very usable, because of which e.g. the file system
test app was having to explicitly set the right values in its sample
configuration. Having a proper defaults in the board defconfig means
this isn't needed anymore.

Change-Id: I1399914451c1616588322e25304d40d3dd1151e7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-08 14:24:25 +00:00
Johan Hedberg
61cfaa1be1 fs: Add simple shell support
Add a simple shell that allows exploring the contents of the file
system.

Jira: ZEP-1235

Change-Id: Iaa49f0be18980dd740e9552ddf4761196a818884
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-08 14:22:33 +00:00
Sakari Poussa
1bfdfbf384 c++: enable subdir-cxxflags
Similar to C subdir-ccflags, enable similar C++ variable subdir-cxxflags

Change-Id: I4355817bc2d6a80a3eebba9b87fbf54725dda5e7
Signed-off-by: Sakari Poussa <sakari.poussa@intel.com>
2016-11-08 13:30:28 +02:00
Genaro Saucedo Tejada
12740a2314 sanity: add DEBUG setting for test_sema
Test was not completing on CONFIG_DEBUG=y setting, current filter
sets custom stack size for such setting

Jira: ZEP-1203

Change-Id: I3a6ada88bc2e8a1fee757773c4b19b72551926a7
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-11-08 01:23:36 +00:00
Leandro Pereira
0be498db5c quark_se: Correctly wait for ARC_READY flag while initializing ARC
The bitwise AND operator was being applied to the boolean expression
"!shared_data->flags" instead of the whole expression because a
parenthesis was lacking.

This bug has been found using Coccinelle using the following spatch,
after finding a similar bug somewhere else in the code base:

      @@
      expression E1;
      expression E2;
      @@

      - !E1 & E2
      + !(E1 & E2)

No other instance of this defect has been found with this spatch.

Change-Id: I6b9ca092f4015c80ddc83c31ce540a92e67cdb11
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2016-11-07 22:22:00 +00:00
Andrew Boie
252144f6e8 samples: remove old kernel support
Change-Id: I89ab1e1926e2e8f07f8c8d5538a7587a605cb36b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:34:18 -08:00
Andrew Boie
e51c4c2989 kernel: remove old kernel support in v2 code
Change-Id: I3675ff42c9742664351975294f61b920995f0c3a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:34:18 -08:00
Andrew Boie
625acd5f4b build: remove old kernel support
Change-Id: If1d29573a0ad4a863f0058c8b8e2c35f5ced6d9e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:34:18 -08:00
Andrew Boie
6450aa455c ieee802154_cc2520: use new kernel sleep APIs
Change-Id: Ia1831108d2f57f76244c9d0a35c47308373aaa1c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:34:15 -08:00
Andrew Boie
9024a93bee drivers: timer: remove old kernel support
Change-Id: I64169402d6e3b6cb0e89beeceba8b5a3bf734cf4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:32:57 -08:00
Andrew Boie
e004dec958 include: remove old kernel defintions
C++ support moved from nanokernel.h to kernel.h.

Change-Id: I5e1631941e26f4ab3f311b680267b743bab15e40
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:32:57 -08:00
Andrew Boie
d25a117cd7 HACK: ztest: fix redefintion of nano_fifo_get()
ztest code redefines this as C function, which causes problems when
it appears in the legacy.h header as a static inline function.

Change-Id: I3ed9fbece3a304f706857a16bdca8dfb11a7802c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:32:57 -08:00
Andrew Boie
4f798177cf kernel: remove old micro/nanokernel C code
include/ will be cleaned up in a subsequent patch.

Change-Id: If3609f5fc8562ec4a6fec4592aefeec155599cfb
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 19:29:19 +00:00
Andrew Boie
5cf1b90461 legacy.h: fix build error with certain configurations
Fixes breakage when K_PRIO_COOP() is used.

Change-Id: I3ec5a281d8eb7c05b78170327bd18ab7615921fc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 19:29:03 +00:00