Commit graph

19237 commits

Author SHA1 Message Date
Johann Fischer
eb501f6253 include: usb: fix style and add standard descriptors to usb_common.h
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-10-13 07:47:48 -04:00
Johann Fischer
d579e577eb include: usb: add usb_msc.h header for MSC devices
Add Mass Storage Class header. The header is based on mass_storage.h,
has been cleaned up and extended by the Class and Protocol Codes.
mass_storage.h will be removed after mass_storage.c has been reworked.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-10-13 07:47:48 -04:00
Johann Fischer
39f0592f54 include: usb: add usb_cdc.h header for CDC ACM/ECM devices
Add USB Communicatons Device Class header. Currently
limited to ACM and ECM devices.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-10-13 07:47:48 -04:00
Robert Chou
4869c16eae net: samples: fix coap_client early unref packet issue
1. After calling sendto(), the packet will be unreferenced.
   Call coap_pending_cycle() to make sure the packet is referenced until
   we got the response from the peer or retransmission timeout.
2. In retransmit_request(), we rearrange the order to avoid the issue.
3. Remove IPv4 configuration for source code is expecting IPv6
4. Correct a typo in README.rst
5. Initialize the interface w/ IPv6 address

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2017-10-13 14:38:18 +03:00
Robert Chou
4fbf721390 net: sample: correct coap-server ETSI TD_COAP_BLOCK_03/04 testcases
When testing against etsi_coaptest.sh, test cases TD_COAP_BLOCK_03/04
will get stuck. This is because these testcases send out a blockwise
transfer but with an empty payload. Although this should be a legit
request, large-update/create handlers did not check "MORE" flag in
block1 option and always return an error when request comes with empty
payload.

Corrected as below
1. Initialize coap_block_context when first block arrives.
   (SIZE1 option is not always available. In the case that SIZE1 is
    unavailable, the zoap_block_context will be re-initialized each time
    a new block has arrived)
2. Check "MORE" flag of block1 option. If it's the last block, then
   an empty payload should be allowed.
3. Response w/ 2.04 CHANGED when the last block has arrived for
   large-update
4. Response w/ 2.02 CREATE when the last block has arrived for
   large-create
5. Remove adding block2 option to the response since we are not sending
   back any data to the caller

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2017-10-13 13:50:28 +03:00
Tomasz Bursztyka
7f04af8f7a net/ieee802154: Add a hw capability for handling ACK request on TX
Some chips are smart enough to handle the ACK request flag on
transmitted frames, so it's unneccessary for the L2 to wait for it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
811db9ac6a net/ieee802154: Expose a function to test for AR flag in net_pkt
This is both required in L2's radio part as well as it might be useful
on some ieee802154 radio drivers.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
e4cb0e67ee net/ieee802154: Removing now useless functions from radio API
Finally removing set_ieee_addr, set_short_addr and set_pan_id which have
been replaced by set_filter.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
ea0aee2bb3 drivers/ieee802154: Stop exposing old radio API functions
set_ieee_addr, set_short_addr and set_pan_id are now unused by L2, so
removing their exposure through the radio API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
4f0b25bef1 samples/wpan: Use set_filter() instead of former API function
Replace set_ieee_addr/set_shord_addr and set_pan_id relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
07f5bde3ed net/ieee802154: Stop using old radio API's functions
These are now fully replaced by set_filter() thus removing their usage
by the L2 layer.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
54b3d6b130 drivers/ieee802154: Implement radio API's set_filter() relevantly
Currently, all drivers seem to support hardware filtering.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
c65c2a1130 net/ieee802154: Apply hw filters when applicable
If the hw supports filtering, L2 will apply the ieee address, short
address or PAN ID filters.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
3d63a3411d net/ieee802154: Add a filter function to radio API
This will replace the current mandatory set_ieee_addr, set_short_addr
and set_pan_id functions, which are only valid if the hardware is
supporting filtering. Which is not the case on some chips.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
eee33cf888 net/ieee802154: Add support for hw driven CSMA
Using radio's get_capabilities, it is possible to know if the driver can
get CSMA work handed-over.

For now, up to device drivers to use
CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_* parameters.

Let's see if it will be interesting at some point to enable runtime
modification of these parameters.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
b2726e14a6 drivers/ieee802154: Implement get_capabilities in existing drivers
Further support will need work per-driver basis, as soon as the L2 will
be able to make usage of such support.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
9c4605583e net/ieee802154: Add a way to retrieve hw capabilities from the devices
This will be useful to know various generic hardware aspects that can be
used relevantly by the L2 layer.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
7be649ea6f net/ieee802154: Remove get_lqi from radio API
Now that lqi and rssi are embedded into net_pkt, there is no need for
that function.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
164cbec9d0 drivers/ieee802154: Set lqi/rssi to net_pkt, stop exposing get_lqi
Both values are now embedded into net_pkt, get_lqi will be removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
aedece5240 net/ieee802154: Use lqi from net_pkt relevantly
This only affects beacon handling logic, not really used feature for
now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka
296cd0ab6d net/pkt: Add 802.15.4 lqi and rssi into net_pkt metadata structure
Instead of having dedicated function on the radio api level for 15.4,
let's just add the relevant values to the net_pkt structure (if only
IEEE802154 is enabled). It's simpler and make the values relevantly
tied to the received packet.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Vinayak Kariappa Chettimada
bebffd3dc6 Bluetooth: controller: Fix missing reset of FC feature
Fixed a missing reset of FC feature on HCI reset. This
feature provided a simple connection handle based event
exclusions, but this is no longer needed with the
support for controller to host flow control. This feature
should be removed in the future.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-10-13 09:23:54 +02:00
Marti Bolivar
b1e6ea27a7 scripts: zephyr_flash_debug: flash like arc_debugger.sh
Only tested by comparing commands that would be run.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
cdffad214f scripts: zephyr_flash_debug: flash like nios2.sh
Only tested by comparing commands that would be run.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
bee6f9e73e scripts: zephyr_flash_debug: flash like openocd.sh
Add support for flashing targets compatible with openocd.sh.

Tested on disco_l475_iot1.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
61aa0e06f5 scripts: zephyr_flash_debug: flash like nrf_flash.sh
Add support for flashing targets compatible with nrf_flash.sh.

Tested on nrf52840_pca10056.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
1126523396 scripts: zephyr_flash_debug: flash like esp32.sh
Add support for flashing targets compatible with esp32.sh.

Only tested by comparing commands that would be run.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
289c0f0304 scripts: zephyr_flash_debug: flash like bossa-flash.sh
Add support for flashing targets compatible with bossa-flash.sh.

This is something of a bug-for-bug reimplementation, as the existing
flashing script makes some potentially unsafe assumptions.

Only tested by comparing commands that would be run.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
4bfbe251ea scripts: zephyr_flash_debug: flash like pyocd.sh
Add support for flashing targets compatible with pyocd.sh.

Tested on 96b_nitrogen, nrf52_blenano2, and frdm_k64f, with and
without PYOCD_BOARD_ID. Additionally, frdm_k64f was tested with
PYOCD_DAPARG_ARG='limit_packets=True'.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
257fa4af90 scripts: zephyr_flash_debug: flash like dfuutil.sh
Add support for flashing targets compatible with dfuutil.sh.

Tested on 96b_carbon.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Marti Bolivar
113ee65b89 build: interpose zephyr_flash_debug.py in flash target
Zephyr board flashing and debugging is done via shell scripts. It
would improve the CMake transition to remove the shell dependency.

Add zephyr_flash_debug.py to allow phasing out the shell scripts.
This takes two arguments:

- a command (eventually flash, debug, and debugserver, but just flash
  for now)

- the path to the corresponding shell script

zephyr_flash_debug.py runs the command in pure Python if it
knows how. Otherwise, it falls back on the shell script. In
this patch, it always falls back. Subsequent patches add support
for existing flash backends.

Invoke zephyr_flash_debug.py from the Makefile flash target, but only
if USE_ZEPHYR_FLASH_DEBUG_SHELL is empty. This lets users keep existing
behavior in case of issues, and can be removed later once the Python
script is more widely tested.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Johan Hedberg
c136a2eb83 Bluetooth: Fix reporting packets for disconnected connections
A connection might have gotten disconnected by the time that an ACL
buffer is free up, in which case there is no need to send a HCI
command for it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-10-12 22:02:14 -05:00
Andrew Boie
a73d3737f1 kernel: add k_uptime_get() as a system call
Uses new infrastructure for system calls with a 64-bit return value.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:25:00 -07:00
Andrew Boie
3ff41b9484 kernel: allow system call with 64-bit return val
This is subject to the constraint that such system calls must have a
return value which is "u64_t" or "s64_t".

So far all the relevant kernel calls just have zero or one arguments,
we can later add more _syscall_ret64_invokeN() APIs as needed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:25:00 -07:00
Andrew Boie
5008fedc92 kernel: restrict user threads to worsen priority
User threads aren't trusted and shouldn't be able to alter the
scheduling assumptions of the system by making thread priorities more
favorable.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:24:48 -07:00
Andrew Boie
8e3e6d0d79 k_stack_init: num_entries should be unsigned
Allowing negative values here is a great way to get the kernel to
explode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 15:09:30 -07:00
Anas Nashif
2516d6e509 toolchains: fix xtools configurations
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-12 16:27:12 -05:00
Anas Nashif
90c1cf1fcf doc: run oldconfig on xtools config
This is needed to reset the configuration options based on the OS we are
building on.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-12 16:27:12 -05:00
Anas Nashif
8ba453b43b doc: fix location of grub script
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-12 16:27:12 -05:00
Andrew Boie
225e4c0e76 kernel: greatly simplify syscall handlers
We now have macros which should significantly reduce the amount of
boilerplate involved with defining system call handlers.

- Macros which define the proper prototype based on number of arguments
- "SIMPLE" variants which create handlers that don't need anything
  other than object verification

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:26:28 -05:00
Andrew Boie
e5b5407ece tests: obj_validation: cleanup
Improved test coverage to reflect current policy and converted to
ztest.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:26:28 -05:00
Andrew Boie
7e3d3d782f kernel: userspace.c code cleanup
- Dumping error messages split from _k_object_validate(), to avoid spam
  in test cases that are expected to have failure result.

- _k_object_find() prototype moved to syscall_handler.h

- Clean up k_object_access() implementation to avoid double object
  lookup and use single validation function

- Added comments, minor whitespace changes

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:26:28 -05:00
Anas Nashif
7bd98a09d5 ci: compliance: decode output to utf8
Fixes GH-1580.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-12 08:47:14 -04:00
Vinayak Kariappa Chettimada
278df482a9 Bluetooth: controller: Fix missing PHY update procedure reset
When a peer master performed a PHY update procedure with no
change, the state machine was not released. This blocked
any future local initiation of the procedure and also
leading to termination of connection with reason LMP
response timeout.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-10-12 11:03:51 +02:00
Andrew Boie
38ac235b42 syscall_handler: handle multiplication overflow
Computing the total size of the array need to handle the case where
the product overflow a 32-bit unsigned integer.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 17:54:47 -07:00
Andrew Boie
37ff5a9bc5 kernel: system call handler cleanup
Use new _SYSCALL_OBJ/_SYSCALL_OBJ_INIT macros.

Use new _SYSCALL_MEMORY_READ/_SYSCALL_MEMORY_WRITE macros.

Some non-obvious checks changed to use _SYSCALL_VERIFY_MSG.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 17:54:47 -07:00
Andrew Boie
32a08a81ab syscall_handler: introduce new macros
Instead of boolean arguments to indicate memory read/write
permissions, or init/non-init APIs, new macros are introduced
which bake the semantics directly into the name of the macro.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 17:54:47 -07:00
Andrew Boie
231b95cfc0 syscalls: add _SYSCALL_VERIFY_MSG()
Expecting stringified expressions to be completely comprehensible to end
users is wishful thinking; we really need to express what a failed
system call verification step means in human terms in most cases.

Memory buffer and kernel object checks now are implemented in terms of
_SYSCALL_VERIFY_MSG.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 17:54:47 -07:00
Andrew Boie
cee72411e4 userspace: move _k_object_validate() definition
This API only gets used inside system call handlers and a specific test
case dedicated to it. Move definition to the private kernel header along
with the rest of the defines for system call handlers.

A non-userspace inline variant of this function is unnecessary and has
been deleted.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 17:54:47 -07:00
Andrew Boie
2b6abf6f89 kernel: USERSPACE implies HW_STACK_PROTECTION
Userspace is built on top of hardware stack protection and assumes
it is there. We can't enable this unless ARCH_HAS_USERSPACE is defined
anyway.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 20:27:10 -04:00