Commit Graph

129 Commits (6a28bce1dd0b74978fc00f0324d73c6785f419fc)

Author SHA1 Message Date
Hugues Kamba 794e32df74 CMake: Use relative paths to list source files and directories
The absolute path is still required for listing linker
files as they are referenced from a function in the top
level CMake input source file.
2020-11-09 12:32:30 +00:00
Hugues Kamba bf84a5b329 CMake: Rename CMake targets
* mbed-os renamed mbed-core
* mbed-os-<COMPONENT> renamed mbed-<COMPONENT>
2020-11-06 17:25:22 +00:00
Martin Kojtal 8529e88e61 cmake: fix present inclusion
We use only _PRESENT macros for components if they are enabled. Use the same in
the mbed.h file or anywhere else.
2020-11-06 17:25:21 +00:00
Hugues Kamba fa98689639 CMake: Componentize Mbed OS into multiple CMake targets (#13732)
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
2020-11-06 17:25:21 +00:00
Hugues Kamba 8b21238e08 CMake: Fix failure due to events and netsocket dirs changes 2020-11-06 17:25:17 +00:00
Hugues Kamba a63fa605e4 CMake: Add support for events dir 2020-11-06 17:25:15 +00:00
Harrison Mutai 4fad1112e5 Add SPDX license identifier to Arm files
Add license identifier to files which Arm owns the copyright to,
and contain either BSD-3 or Apache-2.0 licenses. This is to address
license errors raised by scancode analysis.
2020-10-15 10:47:27 +01:00
Martin Kojtal a6ce2c53a0 platform: move internal headers to internal/
They belong to internal folder to follow our guideline, not in source as they were.
2020-08-20 08:58:00 +01:00
George Psimenos fe7ae8a50f Remove deprecated local unit tests 2020-07-28 09:17:19 +01:00
George Psimenos d480fab08b CI & local unit test fixes 2020-07-28 09:17:19 +01:00
George Psimenos 76f37fb2bc Restructure events directory & move tests 2020-07-28 09:17:19 +01:00
Kevin Bracey 0eff3340d2 Add Chrono support to Event/EventQueue 2020-04-27 10:19:08 +03:00
Maciej Bocianski bc89974462 UserAllocatedEvent: set delay/period at event posting
Event delay/period can be modified by equeue so it has to be reset at every post.
2020-02-12 10:20:28 +01:00
Maciej Bocianski b4fac71325 user allocated events: fix event cancelling
for user allocated events use id for event state tracking
skip event canceling when already canceled or dispatched
2020-02-12 10:20:27 +01:00
Maciej Bocianski acfdc588af equeue: skip equeue_incid call for user allocated events while dispatching
User allocaded events doesn't utilize id field in a way that normal
event does, so we shouldn't call equeue_incid on it
2020-02-12 10:20:26 +01:00
Maciej Bocianski a2e5a34df6 unittests: fix windows build
- set equeue platform to posix for MINGW
 - enable PRIx formatting globally
 - remove redundant Semaphore implementation
2020-02-05 14:20:06 +01:00
Ladislas de Toldi 1507b1c3e1
Add check for __APPLE__ & __MACH__ to fix unit tests on macOS 2020-01-27 16:09:54 +01:00
Kevin Bracey 3d7bff6cdb Test event IDs going negative 2019-10-31 13:36:01 +02:00
Kevin Bracey 8f67043445 Test equeue_cancel returns 2019-10-31 13:35:11 +02:00
Kevin Bracey aad7d9183b equeue: avoid non-standard bit shifts
Shifting negative numbers right is implementation-defined, and shifting
positive signed numbers left and exceeding positive range is undefined.

Take care to make sure we always shift unsigned values.
2019-10-31 13:02:15 +02:00
int_szyk 53be630637 Expand documentation of equeue 2019-09-16 15:11:49 +02:00
int_szyk dc5b9fba09 Tweak equeue chain tests
Changed the order of destroying queues because it is needed to destroy
queues in specified order when they are chained.
2019-09-16 13:35:28 +02:00
Martin Kojtal 5e693778f4
Merge pull request #11441 from gpsimenos/gp-move-source-files
Organize source files and add Doxygen labels
2019-09-11 08:00:03 +02:00
Martin Kojtal 9f35e71ca5
Merge pull request #11446 from maciejbocianski/UserAllocatedEvent_update
add missing asserts to UserAllocatedEvent class
2019-09-10 19:22:34 +02:00
George Psimenos bd95c53a4c Move source files and add Doxygen labels 2019-09-10 14:31:24 +01:00
Maciej Bocianski f5f174474b add missing asserts to UserAllocatedEvent class
Improves code quality by adding MBED_ASSERT to UserAllocatedEvent::delay
and UserAllocatedEvent::period function. This prevent changing already posted event.
2019-09-10 09:50:24 +02:00
Hugues Kamba 5933dec3b7 Harmonise Doxygen comments in drivers, events, platform and rtos dirs
When a Doxygen group has been defined (created), all its needed to add
documentation to that group is `\addtogroup`. Since all the information
about the group is preserved, it is not necessary to mention the group
hierarchy again with `\ingroup`. This PR removes unnecessary Doxygen lines
across the `drivers`, `events`, `platform` and `rtos` directories.

It also ensures that new groups are created with `\defgroup` once and
referenced with `\addtogroup` whenever documentation needs to be added to
an existing group.
2019-09-09 10:59:51 +01:00
Maciej Bocianski 6124343755 fix EventQueue template functions definition
Fix template functions passing UserAllocatedEvent<...> as argument.
2019-09-02 15:57:59 +02:00
Maciej Bocianski b637da37c5 fix astyle 2019-08-30 15:16:18 +02:00
Maciej Bocianski 4c3889dca1 EventQueue: allow passing (0, NULL) on static queue creation 2019-08-30 14:04:43 +02:00
Maciej Bocianski 19e33ba44b UserAllocatedEvent implementation
UserAllocatedEvent provides mechanism for event posting and dispatching without
utilization of queue internal memory. UserAllocatedEvent embeds all underlying
event data and doesn't require any memory allocation while posting and dispatching.
All of these makes it cannot fail due to memory exhaustion while posting.
2019-08-30 14:04:27 +02:00
Maciej Bocianski e7e5cd2aa4 equeue tests: add user allocated events tests 2019-08-29 15:02:41 +02:00
Maciej Bocianski b336f73e77 equeue posix impl: make queue mutex reentrant 2019-08-29 15:02:40 +02:00
Maciej Bocianski 66da694625 equeue: add user allocated event support
Allow posting events allocated outside queue memory
2019-08-29 15:02:14 +02:00
Teppo Järvelin 719117e12c Fix EventQueue::cancel to return value 2019-08-20 15:56:41 +03:00
Hugues Kamba f0f408b2d8 Upstream PR #11073 review request changes (#11135)
* Modify Doxygen grouping of `drivers` Public/Internal APIs
* Correct classification of `mbed_events.h`
* Amend name of Doxygen group containing Device Key API
* Classify `CallChain.h` as public API and relocate file
* Remove Doxygen group from `equeue_platform.h` as it has no Doxygen compliant documentation
* Move USB target specific code back to `usb/device/targets`
2019-08-02 12:32:40 +01:00
Hugues Kamba 20f81e19be Change Doxygen groups structure, splitting first by Public/Internal (#11105)
* Change Doxygen groups structure, splitting first by Public/Internal

This commit also does the following:
* groups the documentation of related API
* moves `events/internal/equeue.h` to `events/equeue.h`
* merges `events/source/README.md` to `events/README.md`
2019-08-02 12:23:47 +01:00
Hugues Kamba bfa1b4dd84 Drivers/Events/RTOS Public and internal APIs cleanup (#10955)
Separate drivers, events, and rtos internal APIs from public APIs.

* Move source files to source subdirs
* Move internal headers to internal subdirs
* Add Doxygen comments for documenting internal and public APIs
* Remove source code from header files in order to remove include pre-processor directives
that included header files not directly used by said header files
* Explicitly include header files instead of implicit inclusions via third-party header files.

Release Notes

This will break user code that was using an internal API as the internal header files have been moved.
This will only break if the user was including the header file using a namespace (i.e #include "foo/bar.h" instead of #include "bar.h"
2019-08-02 12:23:47 +01:00
Seppo Takalo 987533859a
Merge pull request #10104 from kjbracey-arm/sleep_api
Sleep rework, RTOS API for bare metal, wait deprecations
2019-07-17 14:37:53 +03:00
Kevin Bracey 163fb19d97 events: Don't use OsTimer in SysTick builds
Previous fix assumed OsTimer is in use - it is for tickless RTOS builds
and non-RTOS builds, but non-tickless RTOS builds avoid it altogether
and use the SysTick peripheral.

Restore previous behaviour for those builds, and just always read the
tick count - there is no downside to this when ticking.

While in the code, make equeue_tick initialisation explicit. This was
problem if the OsTimer is not yet initialised when th
done while debugging - turns out not to be part of the fix, but it
speeds up the runtime code.
2019-07-16 14:38:08 +03:00
Kevin Bracey 7442da30f9 equeue - avoid Kernel::get_ms_count from IRQ
Kernel::get_ms_count is documented as not working from IRQ.

In RTOS builds it can return misleading answers - see
https://github.com/ARM-software/CMSIS_5/issues/625

In non-RTOS builds, it can trigger an assert, as it upsets the
sleep logic.

Modified code is still not ideal - could be improved further if
there was a fast path for "post now" that didn't bother looking
at timers (both at post time and dispatch time).
2019-07-15 10:13:50 +03:00
Kevin Bracey c94d6a8cc7 Make events use RTOS API
Switch from CMSIS-RTOS to mbed C++ API, which are available in bare
metal build.

Other minor tidies, like removing unnecessary volatile.
2019-07-15 10:13:50 +03:00
Kevin Bracey 013377a857 Revert back to non-variadic binding
Unwind previous commit and restore original behaviour for binding,
pending further investigation.

Some functions like `EventQueue::call` require precisely matching
argument types to get the correct overload, as before.

Others like `EventQueue::event` permit compatible types for binding, and
those handle the 0-5 bound arguments non-variadically in order to
correctly locate the free arguments in deduction.
2019-06-26 11:52:25 +03:00
Kevin Bracey 62062efc37 Constrain context argument types
Previous commit just replaced instances of "class B0, class B1, class
C0, class C1" with "class... BoundArgs, class... ContextArgs".

This loses the requirement that the numbers must match.

Now, the original code was also inconsistent as to whether it used
separate types for the target function and the call input parameters.
Some forms just used B0, B1 as parameters rather than separate C0, C1.

I believe the separate parameters would have been primarily to avoid
template deduction confusion - eg if int was supplied to a B0 parameter
but the function took char as B0, there would be an ambiguity. But the
fix didn't seem to be fully applied.

Rewritten all templates parameterising on function pointer type and
input arguments so that they use `type_identity_t<BoundArgTs>...` as
input parameters to match the target function.

This has the subtle effect that any conversion happens at invocation,
before storing to the context, rather than when the context calls the
target.
2019-06-25 14:47:03 +03:00
Kevin Bracey 4d9148a9dc Reduce Event.h and EventQueue.h using C++11
Variadic templates can reduce Event.h from 4,100 lines to 300, and
EventQueue.h from 3,400 to 1,000, so 6,000 lines saved total.

End result isn't totally variadic, as we still need specialisations
for storing 0-5 values in contexts, but that specialisation is now
in exactly one place.

Only change other from switching to variadic templates is using
delegating constructors instead of the `new (this)` trick. That trick is
still used in the assignment operator.

Minor documentation correction. It's possible that the separate
simplified variadic Doxygen version not be needed now, but I've left it.
2019-06-25 13:48:39 +03:00
Kevin Bracey db18c2252e equeue: align passed-in buffer
Make equeue_create_inplace align the passed-in buffer and size to
sizeof(void *).

Really we should be aiming to align more for ARM, as blocks should be
8-byte aligned, but the internal heap mechanisms only work to 4-byte
alignment at the moment. More work would be needed to ensure 8-byte
alignment of allocated blocks.
2019-04-03 18:29:54 +03:00
Veijo Pesonen 5caed17aee events.shared-eventsize: increased from 256B to 768B
Original value was too small once both ESP8266 driver and
asynchronous DNS started to use shared event queue. An assumption is
made that once shared event queue is taken into use there are going to
be multiple users instead of one, for which the original value would
have been sufficient.
2019-02-26 09:44:15 +02:00
Amanda Butler e7384b09c3
Edit README.md
Edit file, mostly for active voice.
2019-01-09 05:08:55 -06:00
Veijo Pesonen 30a1dd8090 Increases events.shared-stacksize to 2K
ESP8266 driver started to use global event queue to handle some AT
parsing and call Socket::sigio() events. It turned out that when
running DNS tests, or Pelion Client, the stack space (1kB) is not
enough for the purpose.

Therefore we propose that this is raised to 2kB, as the assumption
is that event loop should allow as equivalently complex code than
any other threads.

In Mbed OS, the default Thread stack size is 4kB, but we assume 2kB
to be enough for non-blocking event purposes.
2019-01-04 14:35:46 +02:00
Martin Kojtal ad76c94369
Merge pull request #9066 from deepikabhavnani/equeue_chain_fixed
Equeue chaining bug fixes
2019-01-02 09:16:19 +00:00