Commit Graph

21 Commits (72d2f40bfffeacba4689a816ef03427151b6da4c)

Author SHA1 Message Date
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
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 83354e46a7 Platform: Separate internal APIs from public APIs
Also includes:
* rename `mbed_sleep_manager.c` to `mbed_power_mgmt.c` to match its
  header file
* create Doxygen groups for public and internal APIs
* use relative path to include header files where inconsistent
* update references to internal APIs throughout libraries
* update the copyright year for all modified files
2019-08-02 12:23:47 +01:00
Kevin Bracey 0bb4c050b7 SingletonPtr: API extensions, make constexpr
* Adjust definition to make the default constructor `constexpr`.
  This permits use in classes that want lazy initialization and their
  own `constexpr` constructor, such as `mstd::mutex`.

* Add `get_no_init()` method to allow an explicit optimisation for
  paths that know they won be the first call (such as
  `mstd::mutex::unlock`).

* Add `destroy()` method to permit destruction of the contained object.
  (`SingletonPtr`'s destructor does not call its destructor - a cheat
  to omit destructors of static objects). Needed if using in a class
  that needs proper destruction.
2019-07-18 20:02:04 +03:00
Kevin Bracey 6df6decdfc Fix ARMC5 compilation
Minor tweaks to fix ARM C 5 compatibility.

Pushing "ns_list.h" include to first makes sure "ns_types.h" is included
first, meaning it gets to define `__STDC_LIMIT_MACROS` before the first
include of <stdint.h>, which ensures that UINT8_MAX etc are defined.
2019-06-11 13:00:14 +03:00
Kevin Bracey 87396e0bf6 Assembler atomics
Reimplement atomic code in inline assembly. This can improve
optimisation, and avoids potential architectural problems with using
LDREX/STREX intrinsics.

API further extended:
* Bitwise operations (fetch_and/fetch_or/fetch_xor)
* fetch_add and fetch_sub (like incr/decr, but returning old value -
  aligning with C++11)
* compare_exchange_weak
* Explicit memory order specification
* Basic freestanding template overloads for C++

This gives our existing C implementation essentially all the functionality
needed by C++11.

An actual Atomic<T> template based upon these C functions could follow.
2019-04-26 13:12:35 +03:00
Kevin Bracey 6e41d6cdb7 Make SingletonPtr safe using atomics
SingletonPtr's implementation wasn't totally safe - see "C++ and the
Perils of Double-Checked Locking"by Meyers and Alexandrescu. No problems
observed in practice, but it was potentially susceptible to compiler
optimisation (or maybe even SMP issues).

Now that we have atomic loads and stores, the function can be made safe,
avoiding any potential races for threads that don't take the lock:
ensure that the unlocked load is atomic, and that the pointer store is
atomic.

See https://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/
for more discussion.
2019-01-29 16:01:33 +02:00
Martin Kojtal ad759b7749 platform: add spdx license 2018-11-28 10:39:52 +00:00
deepikabhavnani 2df0289ae9 Resolve build issue for unittest
Error Resolved here is:
SingletonPtr.h:93:13: error: ‘NULL’ was not declared in this scope
2018-11-26 09:53:19 -06:00
Kevin Bracey e7815c64ad Align SingletonPtr data to 8 bytes, or use C++11
Be more cautious about alignment - align the data within a SingletonPtr
to 8 bytes rather than 4. This could increase padding overhead by up
to 8 bytes, sadly, but we may need this alignment for correct operation.

Conditional check added for C++11 - if in use we can get correct minimal
alignment by using alignas(T).
2018-10-16 13:32:52 +03:00
Kevin Bracey 199d1667ff Make SingletonPtr methods const
Make get() and operators * and -> of SingletonPtr const - they are
logically const and thread-safe, despite the construction on first call.
This construction is "invisible" to the caller of those methods.
2018-10-09 18:08:05 +03:00
Kevin Bracey 390f6e7a7b Add * operator to SingletonPtr
Sometimes you want don't want to directly call a method on your
SingletonPtr-wrapped object, but you want to pass it to something
else.

For example

    SingletonPtr<PlatformMutex> mutex;
    mutex->lock();

is fine, but what about

    SingletonPtr<PlatformMutex> mutex;
    ScopedLock<PlatformMutex> lock(*mutex.get());

Add an overload for operator* to make this more elegant:

    SingletonPtr<PlatformMutex> mutex;
    ScopedLock<PlatformMutex> lock(*mutex);

This addition is consistent with standard C++ classes such as
`unique_ptr` and `shared_ptr`, which likewise have
get, operator-> and operator*.
2018-09-05 18:15:47 +03:00
Russ Butler ec19bf1de4 Allow early use of singleton lock
Allow singleton_lock and singleton_unlock to be called before the
RTOS has been started by checking for a valid mutex before locking
and unlocking it.
2018-08-26 12:59:57 -05:00
Martin Kojtal ffcb6ecfb5 platform: astyle update 2018-06-29 10:38:44 +01:00
Senthil Ramakrishnan 3ad298488c Doxygen comment updates and fixes 2017-10-26 15:36:26 -05:00
Bartek Szatkowski b793a3fb89 Update codebase for CMSIS5/RTX5
Update all of mbed-os to use RTX5.
2017-05-30 18:55:52 +01:00
Sam Grove 5e7ce5fa23 [platform] Update doxygen errors from @Note to @note 2017-04-25 14:37:08 -05:00
Jimmy Brisson f945d71319 Update class documentation tags
stop using scope for \addtogroup. It was placing class methods into the
group documentation instead of the class documentation. The new style is
to explicitly tag the class as @ingroup. This new method will allow the
class to be linked in the group page, and the class page will contain
the detailed documentation of the class methods.
2017-04-04 14:21:53 -05:00
Jimmy Brisson f1a78027d3 Add tags to our code 2016-10-04 15:02:44 -05:00
Sam Grove 301b77c4b2 For drivers, events, hal, platform, rtos and mbed.h add one level of path to make sure specific and unique includes files are found. 2016-10-01 02:11:36 -05:00
Christopher Haster 15904b7544 restructure - Split hal into drivers+platform+hal
hal/common/AnalogIn.cpp -> drivers/AnalogIn.cpp
hal/api/AnalogIn.h -> drivers/AnalogIn.h
hal/api/AnalogOut.h -> drivers/AnalogOut.h
hal/common/BusIn.cpp -> drivers/BusIn.cpp
hal/api/BusIn.h -> drivers/BusIn.h
hal/common/BusInOut.cpp -> drivers/BusInOut.cpp
hal/api/BusInOut.h -> drivers/BusInOut.h
hal/common/BusOut.cpp -> drivers/BusOut.cpp
hal/api/BusOut.h -> drivers/BusOut.h
hal/common/CAN.cpp -> drivers/CAN.cpp
hal/api/CAN.h -> drivers/CAN.h
hal/api/CircularBuffer.h -> drivers/CircularBuffer.h
hal/api/DigitalIn.h -> drivers/DigitalIn.h
hal/api/DigitalInOut.h -> drivers/DigitalInOut.h
hal/api/DigitalOut.h -> drivers/DigitalOut.h
hal/api/DirHandle.h -> drivers/DirHandle.h
hal/common/Ethernet.cpp -> drivers/Ethernet.cpp
hal/api/Ethernet.h -> drivers/Ethernet.h
hal/common/FileBase.cpp -> drivers/FileBase.cpp
hal/api/FileBase.h -> drivers/FileBase.h
hal/api/FileHandle.h -> drivers/FileHandle.h
hal/common/FileLike.cpp -> drivers/FileLike.cpp
hal/api/FileLike.h -> drivers/FileLike.h
hal/common/FilePath.cpp -> drivers/FilePath.cpp
hal/api/FilePath.h -> drivers/FilePath.h
hal/common/FileSystemLike.cpp -> drivers/FileSystemLike.cpp
hal/api/FileSystemLike.h -> drivers/FileSystemLike.h
hal/common/I2C.cpp -> drivers/I2C.cpp
hal/api/I2C.h -> drivers/I2C.h
hal/common/I2CSlave.cpp -> drivers/I2CSlave.cpp
hal/api/I2CSlave.h -> drivers/I2CSlave.h
hal/common/InterruptIn.cpp -> drivers/InterruptIn.cpp
hal/api/InterruptIn.h -> drivers/InterruptIn.h
hal/common/InterruptManager.cpp -> drivers/InterruptManager.cpp
hal/api/InterruptManager.h -> drivers/InterruptManager.h
hal/common/LocalFileSystem.cpp -> drivers/LocalFileSystem.cpp
hal/api/LocalFileSystem.h -> drivers/LocalFileSystem.h
hal/api/LowPowerTicker.h -> drivers/LowPowerTicker.h
hal/api/LowPowerTimeout.h -> drivers/LowPowerTimeout.h
hal/api/LowPowerTimer.h -> drivers/LowPowerTimer.h
hal/api/PortIn.h -> drivers/PortIn.h
hal/api/PortInOut.h -> drivers/PortInOut.h
hal/api/PortOut.h -> drivers/PortOut.h
hal/api/PwmOut.h -> drivers/PwmOut.h
hal/common/RawSerial.cpp -> drivers/RawSerial.cpp
hal/api/RawSerial.h -> drivers/RawSerial.h
hal/common/SPI.cpp -> drivers/SPI.cpp
hal/api/SPI.h -> drivers/SPI.h
hal/common/SPISlave.cpp -> drivers/SPISlave.cpp
hal/api/SPISlave.h -> drivers/SPISlave.h
hal/common/Serial.cpp -> drivers/Serial.cpp
hal/api/Serial.h -> drivers/Serial.h
hal/common/SerialBase.cpp -> drivers/SerialBase.cpp
hal/api/SerialBase.h -> drivers/SerialBase.h
hal/common/Stream.cpp -> drivers/Stream.cpp
hal/api/Stream.h -> drivers/Stream.h
hal/common/Ticker.cpp -> drivers/Ticker.cpp
hal/api/Ticker.h -> drivers/Ticker.h
hal/common/Timeout.cpp -> drivers/Timeout.cpp
hal/api/Timeout.h -> drivers/Timeout.h
hal/common/Timer.cpp -> drivers/Timer.cpp
hal/api/Timer.h -> drivers/Timer.h
hal/common/TimerEvent.cpp -> drivers/TimerEvent.cpp
hal/api/TimerEvent.h -> drivers/TimerEvent.h
hal/api/Transaction.h -> drivers/Transaction.h
hal/api/can_helper.h -> drivers/can_helper.h
hal/.yotta_ignore
hal/CMakeLists.txt
hal/hal/analogin_api.h -> hal/analogin_api.h
hal/hal/analogout_api.h -> hal/analogout_api.h
hal/hal/buffer.h -> hal/buffer.h
hal/hal/can_api.h -> hal/can_api.h
hal/hal/dma_api.h -> hal/dma_api.h
hal/hal/ethernet_api.h -> hal/ethernet_api.h
hal/hal/gpio_api.h -> hal/gpio_api.h
hal/hal/gpio_irq_api.h -> hal/gpio_irq_api.h
hal/hal/i2c_api.h -> hal/i2c_api.h
hal/hal/lp_ticker_api.h -> hal/lp_ticker_api.h
hal/common/mbed_gpio.c -> hal/mbed_gpio.c
hal/common/mbed_lp_ticker_api.c -> hal/mbed_lp_ticker_api.c
hal/common/mbed_pinmap_common.c -> hal/mbed_pinmap_common.c
hal/common/mbed_ticker_api.c -> hal/mbed_ticker_api.c
hal/common/mbed_us_ticker_api.c -> hal/mbed_us_ticker_api.c
hal/module.json
hal/hal/pinmap.h -> hal/pinmap.h
hal/hal/port_api.h -> hal/port_api.h
hal/hal/pwmout_api.h -> hal/pwmout_api.h
hal/hal/rtc_api.h -> hal/rtc_api.h
hal/hal/serial_api.h -> hal/serial_api.h
hal/hal/sleep_api.h -> hal/sleep_api.h
hal/hal/spi_api.h -> hal/spi_api.h
hal/hal/storage_abstraction/Driver_Common.h -> hal/storage_abstraction/Driver_Common.h
hal/hal/storage_abstraction/Driver_Storage.h -> hal/storage_abstraction/Driver_Storage.h
hal/hal/ticker_api.h -> hal/ticker_api.h
hal/hal/trng_api.h -> hal/trng_api.h
hal/hal/us_ticker_api.h -> hal/us_ticker_api.h
hal/api/mbed.h -> mbed.h
hal/api/CThunk.h -> platform/CThunk.h
hal/common/CallChain.cpp -> platform/CallChain.cpp
hal/api/CallChain.h -> platform/CallChain.h
hal/api/Callback.h -> platform/Callback.h
hal/api/FunctionPointer.h -> platform/FunctionPointer.h
hal/api/PlatformMutex.h -> platform/PlatformMutex.h
hal/api/SingletonPtr.h -> platform/SingletonPtr.h
hal/api/critical.h -> platform/critical.h
hal/common/mbed_alloc_wrappers.cpp -> platform/mbed_alloc_wrappers.cpp
hal/common/mbed_assert.c -> platform/mbed_assert.c
hal/api/mbed_assert.h -> platform/mbed_assert.h
hal/common/mbed_board.c -> platform/mbed_board.c
hal/common/mbed_critical.c -> platform/mbed_critical.c
hal/api/mbed_debug.h -> platform/mbed_debug.h
hal/common/mbed_error.c -> platform/mbed_error.c
hal/api/mbed_error.h -> platform/mbed_error.h
hal/common/mbed_interface.c -> platform/mbed_interface.c
hal/api/mbed_interface.h -> platform/mbed_interface.h
hal/common/mbed_mem_trace.c -> platform/mbed_mem_trace.c
hal/api/mbed_mem_trace.h -> platform/mbed_mem_trace.h
hal/common/mbed_rtc_time.cpp -> platform/mbed_rtc_time.cpp
hal/common/mbed_semihost_api.c -> platform/mbed_semihost_api.c
hal/api/mbed_stats.h -> platform/mbed_stats.h
hal/common/mbed_wait_api_no_rtos.c -> platform/mbed_wait_api_no_rtos.c
hal/common/mbed_wait_api_rtos.cpp -> platform/mbed_wait_api_rtos.cpp
hal/api/platform.h -> platform/platform.h
hal/common/retarget.cpp -> platform/retarget.cpp
hal/api/rtc_time.h -> platform/rtc_time.h
hal/api/semihost_api.h -> platform/semihost_api.h
hal/api/toolchain.h -> platform/toolchain.h
hal/api/wait_api.h -> platform/wait_api.h
2016-09-30 19:18:09 -05:00