Commit graph

18591 commits

Author SHA1 Message Date
Allan Stephens
dcb31f140d samples: Add test code for sys_thread_busy_wait() API
Enhances the existing nanokernel context test application to
validate busy waiting.

Change-Id: I08cd74f74ed596f0baa30d879e1d98000b1d4c85
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00
Allan Stephens
843f8a6224 doc: Add documentation for sys_thread_busy_wait()
Change-Id: I71f405448f141ae02c28889afd3fc03ddef55ecd
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:28 -05:00
Allan Stephens
6ac33f2b9f kernel: Introduce sys_thread_busy_wait() API
Provides a way for a fiber or task to busy wait for a specified
period of time. This is useful in situations where a delay needs
to be performed without switching execution to another context,
such as:

1) It would take longer to switch to another context and then switch
   back again than to simply busy wait.

2) A delay is required by the kernel's main task (i.e. the nanokernel's
   background task or the microkernel's idle task). This task is not
   allowed to voluntarily relinquish the CPU because this would leave
   the kernel with nothing to execute in its place.

Change-Id: Icbe28613014f659e9528893ae58f7b8008c18a61
Original-work-by: Jeff Blais <jeff.blais@windriver.com>
Further-adapted-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:28 -05:00
Benjamin Walsh
136c18e683 sys_clock: add some more useful time conversion macros
Change-Id: I0ae05d1b9f871b7b832581552442409233cdec5e
Original-work-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:28 -05:00
Anas Nashif
30d1387c5c sanity: add platform/arch exclude functionality
Change-Id: I8af20c04ba8b0872d5196aa166d2479bfa048275
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00
Anas Nashif
07e195a273 samples: use arch_whitelist instead of config_whitelest
Change-Id: I1ef4a2e653ebaa1bf0e62bbc07b29f311c209092
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00
Anas Nashif
f5e3be2af7 build: re-add initconfig to generate .config
run make initconfig to only create the .config in outdir.
The .config will be the result of the defconfig merged with the local
application config define in CONF_FILE.

Change-Id: If2a308ac3805d32cea8dd7be7a14772f22443600
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00
Anas Nashif
267db291e6 sanity: run sha256 on select platforms only
This test takes too long to run, do not run it on multiple
platforms of the same architecture.

Change-Id: I3f121cfd22b99f3910fcbb9ef45a53b0abf79360
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00
Tomasz Bursztyka
27e8c5beb2 samples: Add a tiny test application for ADC API
Currently useful only for Galileo.

Change-Id: I8d4fafd530e11a50f91cedd0de1691393f270b9c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:28 -05:00
Tomasz Bursztyka
5fbf815419 galileo: Kconfig: Add pre-configured settings for Galileo's ADC chip
Setting up the right SPI port, its configuration and max frequency.
Also, setting NANO_TIMEOUTS by default as it is required for delayed
operation inside ADC's driver.

Change-Id: I63b2b872ff858f1d80065a94ba3e2f303d279a67
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:28 -05:00
Tomasz Bursztyka
5bcdfbe255 adc: Adding driver for TI's adc108s102 chip
It's an SPI driven chip and proposes up to 8 channels for input
conversion. It's found on Galileo board.

Change-Id: I916367e9be0849812c6a509082a501730a01ce60
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:28 -05:00
Tomasz Bursztyka
935eedeedf byteorder: Add all remaining helpers for both little and big endian
- making bswap_16 and bswap_32 for both
- adding sys_be16_to_cpu, sys_cpu_to_be16, sys_be32_to_cpu and
  sys_cpu_to_be32

Change-Id: I3aacc91590ee584d83c512d78a9287380969d9aa
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
b6303c0236 galileo: Kconfig: Make SPI built by default
Taking the opportunity to set simpler driver names for port 0 and 1.

Change-Id: I994bc43daaf6bc43b0dad564a72577c874f72d2d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
524a50e61e spi: Add a utility pointer for the application on SPI callback
It might be needed sometime to get some private data forwarded to the
callback, thus such user_data pointer is the easiest way to proceed.
Adding a macro to set the word size as well.

Change-Id: I68cbe2d480120253ccb13f13c656a38c27e21604
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
ded73a41b1 spi: intel: Only look for TFS and RFS in status when handling isr
If those are not set it means the controller has nothing to request
anymore from the driver.

Change-Id: Ie7e834e82b931e4b02ded3f9f619735b31b0a121
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
6090d779d7 spi: intel: Move back private structures to the right locations
Since the driver is the only one needing those, no need to expose them
anywhere.

Change-Id: Iac4eaa65a9dbdaa8e72c70ea0de35cd2b3d836d1
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
f18275a5be spi: intel: Switch CS before unmasking and after masking interrupts
At this points the slave is ready to deal with the master.

Change-Id: I815d3c577bd0b73100cbf585cc8ca78f180ec713
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
15058e21ef spi: intel: Fixing how speed is set
This was failing, the documentationg provides numbers only telling at
one places these are hexadecimal values. So switching to hexadecimal.
Then DDS rate retrieving macro was bogus, so fixing it.
And adding debug output about the DDS rate and the clock ratio.

Change-Id: I9cc414796fbd7f7123f1f406c6bce7ffacf641e8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
93f38d26c2 spi: galileo: Fix SPI port 1 settings names
*_PORT_1_* not *_PORT_0_* obviously.

Change-Id: Idefad40c25b4ad54d9558355daab224bc634c2e7
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
77d6c32fc2 spi: galileo: Set the right default interrupt type
Galileo SPI interrupt is of type level low, thus setting it to this
value in Galileo's defconfig and removing useless entry in Kconfig.

Change-Id: I90bcc74be1a957bf59912d6f8c2234cfa4fe2329
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Tomasz Bursztyka
e6fc1c2049 adc: Add drivers infrastructure
Only Kconfig file for now.

Change-Id: I633ac209583b2fe6cbed3c75036ac245f0058df6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Dan Kalowsky
24aa678401 adc: adding API include file
Change-Id: Ia9c003261d3f07bf9ecbe406b09c6136712e923b
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung
1c96cdeb52 i2c: simplify API and driver_api with generic transfer function
With the introduction of generic transfer function, it is no longer
needed to specify read or write functions explicitly in drivers.
All read/write functions can now thus call the generic transfer
function to achieve the same result.

With this change, the transfer function becomes mandatory, and
should always be available.

Change-Id: Ia6fb98e58b84330a56a5d44ed3df9db42c3a5e88
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung
827f6d018b gpio: pcal9535a: use i2c_poll_transfer() for register read
The newly introduced i2c_poll_transfer() is now used for register
read for PCAL9535A GPIO driver. The old write then read does not
work because every read or write ends with STOP. However,
the chip requires RESTART after writing the register address.
So the new generic transfer function is perfect for this.

Change-Id: I56d7ebe08f68cb04731c72138d60645ef124f65e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung
01796ecf5c i2c: dw: implement generic transfer functions
() For interrupt driven transfer, the driver already has
   a generic transfer function, so this simply exposes it
   for public consumption.
() The polling write is extended to support generic
   transfer.

Change-Id: I657db8a6376282c723728b7a875813d389cf7d27
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung
ac0beb7034 i2c: add API for generic transfer
Add an API to I2C for generic transfer. This is for those data
transactions which are more complex than simple read or write.

One example use of this is to read register data from a slave
device. The master has to write the address of the register
to slave, then start reading from slave for register data.
In this situation, simple read or write is no longer
sufficient, as for some slave devices, they require RESTART
when data transfer direction changes. Doing a simple write via
i2c_write() results in STOP at end of transfer, which results
in the slave not responding to read request as it is not
expected to send anything back.

Change-Id: I22f9c5ba2f7a7c48a33b9cb1aaf559e596a85d39
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung
76bfe7b3a1 i2c: dw: re-organize transfer related code
() Re-organize the steps involved in data transfer, according to
   the datasheet's flowchart.
() Extract the common code for transfer initialization and put
   it into its own function.
() i2c_write() and i2c_polling_write() are now using the common
   data sending function.

Change-Id: Ieb90253ee10ddceb3b5d05b258e7fc6253d18729
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung
7551562a14 uart: make poll_in and poll_out mandatory
Polling in/out are basic UART functions that are supposed to
work on every UART controllers. Therefore, both poll_in and
poll_out are now mandatory. The API no longer checks if
they are defined before calling. This is to avoid the if
statements so to speed up things a bit.

Change-Id: I3bd1e7a2dfa5405699ebaec3eb34cfc0434b0073
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Daniel Leung
c615ae56cb serial: nsim: add dummy poll_in function
Both poll_in and poll_out are supposed to be implemented
in each driver, as these are basic function.

Change-Id: If1b6b11834f57934fe7e776bfcf818e088abdd0a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:27 -05:00
Dan Kalowsky
94d60babaa tinycrypt: use tabs not spaces
Passing checkpatch check to use tabs instead of spaces for everything.

Change-Id: Ieffa0b0cc4b24598e7cbce7edf9ed640c8fb27dd
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:27 -05:00
Dan Kalowsky
31ff5ad01f tinycrypt: moving includes
Moving the includes to include/tinycrypt. This will help make it
clear when looking at source files where each header originated from.

Change-Id: Ic79978da286f9c288868074a69262d89488925b8
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:27 -05:00
Andrew Boie
9882dcd3d2 sanitycheck: look for misaligned XIP VMA/LMA addresses
XIP is currently implemented in Zephyr by copying only the RW
sections from flash into RAM. For these sections, if the VMA spacing
is different than the LMA spacing the sections in RAM will not be
at the right addresses. Warn about this situation.

Change-Id: I59a55fc27703103e37a7f0bbc34f236047621e0e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:27 -05:00
Andrew Boie
73b4ee69b7 sanitycheck: binary size calculation improvements
- Several recently added binary sections were not being taken
  into consideration, unknown sections now trigger test case
  failure
- Use same VMA/LMA terminology that objdump uses and show both
  addresses

Change-Id: I641eef64aaed6612f62e5aa092f66baaa2797c70
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:27 -05:00
Andrew Boie
c2a9a37e1c test_task: fix startup race
Bad things happen if an SW IRQ is asserted before it is initialized.

Change-Id: I4ad48480c4d7bb5fc14d778d2566d73086300fa1
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:27 -05:00
Anas Nashif
93f06fad7d Revert "tinycrypt: moving includes"
This commit breaks the sanitychecks

This reverts commit 93fa1053b21efe3d030ea060a31b80d6008d5bfd.

Change-Id: Ia52092e845c33234817a1cb27cd1f17064c65e7e

Signed-off-by: Anas Nashif <nashif@linux.intel.com>
2016-02-05 20:24:27 -05:00
Anas Nashif
cd6e315167 Revert "tinycrypt: use tabs not spaces"
breaks sanitychecks

This reverts commit 6712ac6c73dcfd6a8e5dc04f6e05ab33b8dbf51c.

Change-Id: I69c3938da0d215b63361cf4d741f2c978ad80661

Signed-off-by: Anas Nashif <nashif@linux.intel.com>
2016-02-05 20:24:27 -05:00
L.S. Cook
86f851c55a doc: adding :dfn: syntax where needed
Updated as per Allan's comments to correct use of Zephyr
kernel in lieu of codename variable

Change-Id: Iaf5f8531c5452b6d8fb13318f00050aa63d99200
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
2016-02-05 20:24:27 -05:00
L.S. Cook
cb9749f443 doc: directive indentation fixes on language.rst
Editing language.rst file to clarify a few items
Also correcting a few things I missed earlier
Also fix title case without hyphen to be consistent

Change-Id: I463d1cdb436957a14af6ea40933f892a51b161aa
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
2016-02-05 20:24:27 -05:00
Dan Kalowsky
3b650c5c44 tinycrypt: use tabs not spaces
Passing checkpatch check to use tabs instead of spaces for everything.

Change-Id: I2fdd507d48db83fda8d183043c5a4ab1b97148dc
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:27 -05:00
Dan Kalowsky
9d506d0a26 tinycrypt: moving includes
Moving the includes to include/tinycrypt. This will help make it
clear when looking at source files where each header originated from.

Change-Id: I062cb3c6ecc5bc2ed2d28228d5926646b6b5f912
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:27 -05:00
Dan Kalowsky
53dbe1f1ec crypto: comply with checkpatch file length
Fixes the tinycrypt library to use Zephyr checkpath acceptable line
lengths.

Change-Id: Ia7bef46a39fa029cda826ec5b2d7d42036d9bdfe
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:26 -05:00
Andrew Boie
579a490ea3 test_sema: fix initialization race
If the other tasks try to trigger a SW IRQ before MONITORTASK
has initilized it, the CPU generates an exception.

Change-Id: Id2745d728a7cf15132096585c073f85f8306cb38
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
966401307e x86: Allow use of simple_uart driver with ia32 target
Needed to get simple uart driver working in qemu with
SLIP networking or qemu<->qemu network testing. Because
this is only needed in qemu the patch only touches ia32
platform.

This can conflict with Bluetooth in x86 and qemu so caveat emptor.

Change-Id: Iba20543f968c8fd37ee36747d9aa1ad3f782057d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00
L.S. Cook
1f901bd491 doc: change bash to console refs
Also: fixed trailing whitespaces.
Also: integrated comment change suggestions from GA

Change-Id: I41f7052d9895e0c61ad0e76be989ea6161f9ed83
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
2016-02-05 20:24:26 -05:00
Leona
c98560f783 doc: edit of gerrit tutorial
Change-Id: I3f5831d5e41968c5ce43cc1042565f7677025caa
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
Signed-off-by: Leona <lsc@hackeress.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
0fe883ccb1 Bluetooth: Fix not reseting required security in case of error
If bt_conn_security failed required security level should be set
back to current security. Otherwise it might not be possible to
try later on with lower security.

Change-Id: I3ad7151f2cdff15147b9948bbdab516b8cc16ce2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Mariusz Skamra
ab665fbe27 Bluetooth: Clear pairing flag if all keys have been distributed
This fixes the bug that affected pairing as peripheral.
With this patch pairing flag is cleared and timeout timer stops
if all keys has been distributed.

Change-Id: If7575197d5a42a0ca5bb158ea5607934e92abb81
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
7aae2849c3 Bluetooth: Rename connection state notify functions
Rename bt_conn_connected to notify_connected. This will avoid
confusion with BT_CONN_CONNECTED state name. Same goes with
bt_conn_disconnected.

Change-Id: I6e9d50016036b30345068ef2a6bb556c45d7dd06
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Szymon Janc
89f8453ebe Bluetooth: Don't delay bt_conn connected callback
Delaying only connected callback resulted in races where security
or pairing callback could be called before bt_conn connected.

Currently only procedure that relies on read features is connection
parameters update and that should not conflict with other traffic.

Change-Id: I835535abbff21ea8d86b728f5681f90ef9fd337c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:26 -05:00
Jukka Rissanen
6dba9310d4 net: Keep track of number of free L2 buffers
Print current number of free MAC buf count when allocating
or freeing mbufs.

Change-Id: I3c434671b28ac4b4d8c8d968899e891391d849d9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:26 -05:00