Commit graph

41120 commits

Author SHA1 Message Date
Anas Nashif
70ff4c91e5 gpio: fixed struct name causing build failure
bad rebase that somehow passed sanity

Change-Id: I7aa7da44cbcb28b9abe3bb81b1ff8d510d135a24
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:42 -05:00
Anas Nashif
14cb8da750 Revert "kbuild: add clang support"
This reverts commit 58fd0778c6dcc6bd3148b5d07615cd7bd777f456.

Change-Id: Ibffe036d2e182652b3c966c10ed405c9386f823c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:42 -05:00
Andrew Boie
b43758d22a x86: remove dynamically generated IRQ and exception code
We are interested in supporting some XIP x86 platforms which are
unable to fetch CPU instructions from system RAM. This requires
refactoring our dynamic IRQ/exc code which currently synthesizes
assembly language instructions to create IRQ stubs on-the-fly.

Instead, a new approach is taken. Given that the configuration at
build time specifies the number of required stubs, use this
to generate a build time a set of tiny stub functions which simply
push a 'stub id' and then call common dynamic interrupt code.
The handler function and handler argument is saved in a table keyed by
this stub id.

CONFIG_EOI_HANDLER_SUPPORTED removed, the code hasn't been conditionally
compiled for some time and in all cases we call _loapic_eoi() when
finished with an interrupt.

Some other out-of-date verbiage in comments related to supporting
non-APIC removed.

Previously, when dynamic exceptions were created a pointer would
be passed in by the caller reserving ram for the stub code. Since
this is no longer feasible, two new Kconfig options have been added.
CONFIG_NUM_DYNAMIC_EXC_STUBS and CONFIG_NUM_DYNAMIC_EXC_NO_ERR_STUBS
control how many stubs are created for exceptions that push
an error code, and no error code, respectively.

SW Interrupts are no longer triggered by "int <vector>" hard-coded
assembly instructions. Instead this is done by sending a self-directed
inter-processor interrupt from the LOAPIC, using a new API
loapic_int_vect_trigger(). In this way we get rid of dynamically
generated code in irq_test_common.h.

All interrupts call _loapic_eoi() when finished, since this is now
the right thing to do for all IRQs, including SW interrupts.

_irq_handler_set() for x86 no longer requires the old function pointer
to be supplied.

Change-Id: I78993d3d00dd153c9051c518b417cce8d3acee9e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
c159380c86 gpio: make function names conform to driver name
use gpio_dw instead of gpio_<function>_dw to be consistent in the
driver itself and with other drivers.

Change-Id: Ifb0e50c230f142197eb4b01c1bb4ce1c16e4753f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
0d0cb8e661 kbuild: add clang support
Clang support already existed in the Makefiles but was not complete
and some gcc options did not work with clang. Move those to be conditional
on the compiler used to make clang work.

To build with clang for x86:

make  CC=clang  -C samples/microkernel/apps/hello_world/

You still need the gcc cross environment for various tools.

For now, only x86 was tested.

Change-Id: I1a50c3a82d79ff3001beb4366961ca810eeb6006
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
98e0c2cfbc gpio: use BIT macro defined in misc/util.h
We now have BIT defined in a header file globally, so lets use it.

Change-Id: Ie7b87478cb5a9e977ec045efa072d28fab86e78b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Juan Manuel Cruz
71c289dfbc asm: add asm inline for system set/clear/test bit
This commit adds asm implementation for the methods:
 sys_io_set_bit
 sys_io_clear_bit
 sys_io_test_bit
 sys_io_test_and_set_bit
 sys_io_test_and_clear_bit

Change-Id: I144568e113316fa43d943cdc5457cb17e66839c3
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:41 -05:00
Yonattan Louise
5563290d36 Add group definition to event logger.
Add the tags required by doxygen for defining the group of the
kernel event logger.

Change-Id: I96ec6b6604da5a541ce8041e6fa3c324a03ff698
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:24:41 -05:00
Yonattan Louise
e378747706 Rename Profiler to Event Logger.
In order to have a name according to the functionality of the feature.
This commit rename any text, function and variable related with the
Profiler name to Event logger.

Change-Id: I4f612cbc7c37965c35a64f06cc3ce5e3249d90e5
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:24:41 -05:00
Allan Stephens
16504c27c1 kernel: Revise microkernel server's recognition of command types
Revises microkernel server command stack processing to allow the
server to support more than 2 types of commands. The lowest 2 bits
of the command now indicate the command's type:

0 - process specified command packet
1 - give specified event (from ISR or fiber)
2 - give specified semaphore (from ISR or fiber)
3 - reserved for future use

Note: Support for type 2 will be provided in a future commit.

Change-Id: I9f83f92a301fb5df3dd479b5d43b187371e11ad8
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:41 -05:00
Allan Stephens
d765602ec0 kernel: Minor tweak to generation of microkernel TICK_EVENT
The tick event is now generated by calling the standard API for
signalling an event from an ISR. (This allows the tick event
to be generated properly even if the internal implementation of
the event sub-system changes.)

Change-Id: Ia2be3874358acb0ea2b2d2bbefbe4603fe11da8a
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh
334c14e66e x86: CLFLUSH and cache line size detection
Detect the presence of CLFLUSH instruction and cache line size at
runtime. It is still possible to set them manually via kconfig options
if the values are known.

Change-Id: I00bda1de4c5c241826ead6f43b887b99a963cc7b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh
aed578cb03 x86/cache: rename _SysCacheFlush to sys_cache_flush
Change-Id: Idb1bbedea9577856ea6db08683ea4a4ead92e14d
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Peter Mitsis
5ff5c62bdc arc: Add paddr_t/vaddr_t
ARC targets now have access to the address types 'paddr_t' and 'vaddr_t'.

Change-Id: I2cccddbdd76771529e4501aaee6cb2a2b640013e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh
4690457b17 arm: Add paddr_t/vaddr_t
ARM targets now have access to the address types 'paddr_t' and 'vaddr_t'.

Change-Id: Ic7225647f3776d4afa853cf2c4a19699b656866a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh
b55e2fc50a x86: Add addr_types.h to arch.h
This makes the types 'paddr_t' and 'vaddr_t' available via nanokernel.h.

Change-Id: I75b81356566e2063979f2ec46f326d606638efa2
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Benjamin Walsh
b7875a0bc8 x86: Rename PHYS_ADDR/VIRT_ADDR to paddr_t/vaddr_t
Change-Id: I8e037278f2f1d409360c52276cb4dae87b9ad440
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:41 -05:00
Peter Mitsis
b1c1020732 Add UART irq input hook to uart_console_isr()
Adds an input hook to be used by the interrupt handler uart_console_isr().
This hook permits the console input to detect a character escape sequence
that can be used to override the console's default input behavior.

This input hook can be set using the following API:
   void uart_irq_input_hook_set(struct device *dev,
                                int (*hook)(struct device *, uint8_t));

The hook returns 1 if the handler should stop processing the character,
and 0 if it should not stop.

Change-Id: I95e7da75e07fb6caaca2d45e80bfc4334a43c0ac
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
b2147178b4 build: remove unsupported targets from Makefile
Remove goals that call scripts we do not have or support.

Change-Id: Ic6f1d2b620e20f7355e1dec0a2454239fad8f123
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
6c625c925f kbuild: remove unused and unsupported GCOV_KERNEL
CONFIG_GCOV_KERNEL comes from Linux, we do not use this feature
in Zephyr.

Change-Id: Ibef77ac4b26f2831b2fbba25e2a4d72899d75974
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Andrew Boie
8c4f2321e3 test_atomic: test case to verify atomic.h
These tests ensure the functions manipulate data as expected.
They do not currently test atomicity.

Change-Id: I3646b3a55ffb895c56dbb0d0bc39da5e1138e7a5
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:41 -05:00
Andrew Boie
8397dc5028 _irq_handler_set: don't require old function as parameter
This was kept around since it used to be necessary for x86, and we
want our APIs to keep partity across arches, but with the x86 IRQ
refactoring this is no longer needed.

Change-Id: Iacd61f4c4d3cc33b4a15bfa083e106ba6d5da942
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
39dceb21f6 uart: simple: throw an error if configuration options not provided
The simple uart drivers expects configuration options to be defined in
board.h and fails on platforms that do not provide such options.
Throw an error if needed configuration options are not provided.

Change-Id: I8c938868171eb8c1382075275ad96379cfc05a5a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Juan Manuel Cruz
faa11b76ee gpio: remove both edge support on dw arc ip
Allows to remove the both edges support from the DW GPIO driver.

Change-Id: I9e39cca320aeac5d10aafe7a83641917ad004fe6
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
4115d68ef9 link: remove unsupported features
Removing unsupported features that we inherited from Linux kbuild

Change-Id: I7cf19f913b0a7ba6195d2cb9c04b426144bdebb9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
c0078cfb9b Remove linux features in build process that we do not support
Lots of code that is not being used by Zephyr but makes debugging and find
issues related to zephyr very difficult.

Change-Id: If8f6515d68f64b03cc881a9c3cde48c0451fe3b5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Anas Nashif
0c39517251 makefile: put app files in seperate target
Application source code is not a core component of the kernel.
Remove from core-y and put the application tree in its own category.

Change-Id: I1d6f479829eb58b9a49baf90aaf9f74187660b86
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:41 -05:00
Dan Kalowsky
7ed1abfdda checkpatch: warning - new_typedefs
Removing many of the typedefs that are only used once to lessen the
checkpatch warning about creating new typedefs.  A handful have been
behind as they would require a more invasive change to the code.  It
has yet to be determined if this is a worthwhile endavour.


Change-Id: Ibeb29e0a1d37e8121218fccf0d986cbebd226e85
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:41 -05:00
Luiz Augusto von Dentz
5bd4324ae2 Bluetooth: L2CAP: Unref buffer after calling recv callback
This simplify the handling quite a bit while the application can still
prevent the buffer to be freed by referencing it if necessary.

Change-Id: I5ed0e96e8d9e349b79ba31ba9568af61181e1065
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:41 -05:00
Luiz Augusto von Dentz
0475c0339d Bluetooth: L2CAP: Fix MTU value
Since segmentation is not enable the maximum SDU/MTU that could be
received is MPS - 2 since the first 2 bytes are used to inform the
SDU length.

Change-Id: I93b2f5b5bd5897870799db130d82476e520ee927
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:41 -05:00
Luiz Augusto von Dentz
6da7f385a5 Bluetooth: L2CAP: Send LE Flow Control Credit
This adds logic to send more credits whenever it went bellow the
define threshold (50% of maximum):

> ACL Data RX: Handle 3585 flags 0x01 dlen 16
      Channel: 64 len 66 [PSM 128 mode 0] {chan 0}
        40 00 18 00 00 00 40 00 7f 7f 7f 7f 7f 7f 7f 7f  @.....@.........
        7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f  ................
        7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f  ................
        7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f  ................
        7f 7f                                            ..
< ACL Data TX: Handle 3585 flags 0x00 dlen 12
      LE L2CAP: LE Flow Control Credit (0x16) ident 58 len 4
        Source CID: 64
        Credits: 1

Change-Id: If12f3012a5405beca696edab3dd31775818bdeb8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
6d60cee320 Bluetooth: Use bt_hci_cmd_send_sync for host buffer size
Follow the same conventions as for all other HCI commands that are
part of the init sequence.

Change-Id: Ia88b66044d903be103b9ce9fdc2a026a38ac551a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Arkadiusz Lichwa
e16bb2282e Bluetooth: Refactor hci_init routine
Groups logically the sequence of hci initialization.

Change-Id: I6b465e79e809ce6514b8d6cc7563e4ee9775d324
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:40 -05:00
Luiz Augusto von Dentz
e5a1e66f9a Bluetooth: L2CAP: Handle disconnection request
This handle disconnection request removing the existing channel and
responding properly:

> ACL Data RX: Handle 3585 flags 0x02 dlen 12
      LE L2CAP: Disconnection Request (0x06) ident 2 len 4
        Destination CID: 64
        Source CID: 64
< ACL Data TX: Handle 3585 flags 0x00 dlen 12
      LE L2CAP: Disconnection Response (0x07) ident 2 len 4
        Destination CID: 64
        Source CID: 64

Change-Id: I13a57852f5c341a067c326c457b0200de438a54e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:40 -05:00
Luiz Augusto von Dentz
92b40ae0df Bluetooth: L2CAP: Fix selecting MPS based on buffer tailroom
It doesn't make sense to derive MPS from buffer tailroom since that a
signalling header, futhermore the buffer from signalling and data can
now have different sizes so instead just calculate the MPS based on
maximum buffer size.

Change-Id: Ieaac94b575c5d21711e0cb4b2685913977f057f3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
4e2880f9c1 Bluetooth: Make sure fixed channels have the tx CID set
Right now we don't rely on this value being set, but we might in the
future.

Change-Id: Icc560b6935582a9e6dc268d21ce0784773aa480d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
c20b68a221 Bluetooth: Remove broken check for existing rx CID
This check was trying to optimize the CID allocation, but it adds
little value and was actually broken because of the wrong CID passed
to the lookup function.

Change-Id: I793be0c5eeccb931cea4a5430991d4e692926da6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
4f66545ba7 Bluetooth: Add clarifying comment to l2cap_chan_alloc_cid()
Make it clear why we're checking for non-zero rx CID.

Change-Id: I07a44cf1a0f28c540b191e24aba4d0519c338eaf
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
b5245cb9db Bluetooth: l2cap: Fix setting unnecessary DCID header in response
For an LE L2CAP Connect Response with a failure error code the core
specification states:

"The DCID, MTU, MPS and Initial Credits fields shall be ignored when
the result field indicates the connection was refused."

This means that there's no point in setting any specific value to it,
i.e. it can be left to 0 as set by memset.

Change-Id: Iead8039c7b60e1cf766e9ab14691e83fe9813288
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Jukka Rissanen
736e8b1bf9 net: test: Remove the test_15_4 testcase temporarily
The test causes random failure so remove it temporarily.

Change-Id: I0b74877ad27d673099d0eecb191b6978bf9b40ee
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
450a124c3f Bluetooth: Fix checking for existing dynamic CID
L2CAP_LE_DYN_CID_END is still a valid CID so we should include it in
the search.

Change-Id: I5ead169fd9114c5d418e2e4f504d82faca8b1afa
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
4c6a95bb55 Bluetooth: Add missing check for invalid dynamic CID
When receiving an LE L2CAP Connect Request we should verify that the
proposed remote CID is within the dynamic CID range, and if not return
the appropriate error.

Change-Id: I54ca2431f0f622f96bc2c3acbd3de7ca4c92713a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
394de5d2c1 Bluetooth: L2CAP name dynamic CID ranges appropriately
Change-Id: If66ab2e80c2a0d5c877a4e465363c1d05c8e643a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
d858444eb5 Bluetooth: l2cap: Fix error code for SCID in use
If we receive a connect request for an SCID that's already allocated
we should return the appropriate "SCID in use" error for it instead of
"No resources".

Change-Id: I1c1e1bba7059c8a37a8cc01c4bb2f3fbd7aab67d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
2b68871f7c Bluetooth: uart: Fix discarding data in case of too small buffer
Even if a buffer can't hold the needed amount of data we should still
cleanly discard the bytes so that the driver doesn't loose sync of the
next packet boundary. This way we also get to remove the now
unnecesary 'failed' label.

Change-Id: Ic921fbf6c0ddef4a7721cee7fa3e01a31b127778
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
b620f6a5ae net: samples/buf: Fix Kconfig option name
Change-Id: Ib120b2a746aa319b7c0ea943e23a83b45aefaf31
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Luiz Augusto von Dentz
701404624e Bluetooth: L2CAP: Don't limit tx MTU
This store the original MTU sent by the remote instead of limiting it to
the amount the buffer can allocate since buffer sizes can now be
different and it was anyway wrong to assume the size of buffer used for
signalling would be the same as in data packets.

Change-Id: I52c7e4946ae949a0068ce28a00d2b427a48a1b51
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:40 -05:00
Luiz Augusto von Dentz
b861797736 Bluetooth: Fix not unreferencing buffer
Buffer received over L2CAP dynamic channels needs to be unref by the
application once they are done with it.

Change-Id: If210be1c538cf0b550dd03094d007b6851cdfbf4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg
c73a6fd017 Bluetooth: Adjust lower bound of HCI command size
Currently the biggest required HCI command is HCI_LE_Generate_DHkey
which needs 1 (H4 header) + 3 (cmd header) + 64 = 68 bytes.

Change-Id: Ice142b7c68c1cb1571e03549bceb301d806bc453
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:40 -05:00
Jukka Rissanen
db51867a2b net: Fix NET_BUF_ASSERT macro compile error
This commit fixes this compile error if network buffer debugging
is activated.

  CC      net/buf.o
net/buf.c: In function 'net_buf_unref':
net/buf.c:40:31: error: expected expression before 'if'
 #define NET_BUF_ASSERT(cond) (if (!(cond)) {    \
                               ^
net/buf.c:81:2: note: in expansion of macro 'NET_BUF_ASSERT'
  NET_BUF_ASSERT(buf->ref > 0);
  ^

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