Skip to content

Commit

Permalink
RTOS public apis (#1)
Browse files Browse the repository at this point in the history
* Moved source files and internal headers to internal/
* Added doxygen commands
  • Loading branch information
evedon authored and hugueskamba committed Jul 3, 2019
1 parent 7059221 commit f4b986d
Show file tree
Hide file tree
Showing 30 changed files with 97 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "SPI.h"
#include "inttypes.h"
#include "Timeout.h"
#include "platform/mbed_error.h"

#define TRACE_GROUP "AtRF"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <string.h>
#include "rtos.h"
#include "mbed_interface.h"
#include "platform/mbed_error.h"

using namespace mbed;
using namespace rtos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Timeout.h"
#include "Thread.h"
#include "mbed_wait_api.h"
#include "platform/mbed_error.h"

using namespace mbed;
using namespace rtos;
Expand Down
13 changes: 9 additions & 4 deletions rtos/ConditionVariable.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
#include "platform/NonCopyable.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api Public API */
/** @{*/

struct Waiter;
/**
* \defgroup rtos_ConditionVariable ConditionVariable class
* @{
*/

/** The ConditionVariable class is a synchronization primitive that allows
* threads to wait until a particular condition occurs.
Expand Down Expand Up @@ -325,7 +330,7 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
#endif // !defined(DOXYGEN_ONLY)
};

}
#endif

/** @}*/
/** @}*/
} // namespace rtos
#endif
3 changes: 2 additions & 1 deletion rtos/EventFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
#include "platform/NonCopyable.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_EventFlags EventFlags class
Expand Down
6 changes: 3 additions & 3 deletions rtos/Kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#include "cmsis_os2.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/

/** Functions in the Kernel namespace control RTOS kernel information. */
Expand Down Expand Up @@ -60,7 +61,6 @@ void attach_thread_terminate_hook(void (*fptr)(osThreadId_t id));

} // namespace Kernel

/** @}*/
} // namespace rtos
#endif

/** @}*/
4 changes: 2 additions & 2 deletions rtos/Mail.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "Queue.h"
#include "MemoryPool.h"
#include "cmsis_os2.h"
#include "mbed_rtos_storage.h"
#include "mbed_rtos1_types.h"

#include "platform/mbed_toolchain.h"
Expand All @@ -39,7 +38,8 @@ using namespace rtos;
#endif

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_Mail Mail class
Expand Down
6 changes: 5 additions & 1 deletion rtos/MemoryPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@
#include "mbed_rtos1_types.h"
#include "mbed_rtos_storage.h"
#include "platform/NonCopyable.h"
#include "platform/mbed_assert.h"
#include "Kernel.h"


namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_MemoryPool MemoryPool class
Expand Down
3 changes: 2 additions & 1 deletion rtos/Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
#include "platform/mbed_toolchain.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/

class Mutex;
Expand Down
5 changes: 3 additions & 2 deletions rtos/Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
#include "cmsis_os2.h"
#include "mbed_rtos1_types.h"
#include "mbed_rtos_storage.h"
#include "platform/mbed_error.h"
#include "platform/mbed_assert.h"
#include "platform/NonCopyable.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_Queue Queue class
Expand Down
3 changes: 2 additions & 1 deletion rtos/RtosTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
#include "mbed_rtos1_types.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_RtosTimer RtosTimer class
Expand Down
3 changes: 2 additions & 1 deletion rtos/Semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
#include "platform/NonCopyable.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_Semaphore Semaphore class
Expand Down
10 changes: 4 additions & 6 deletions rtos/TARGET_CORTEX/SysTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
namespace rtos {
namespace internal {

/** \ingroup rtos */
/** \addtogroup mbed-os-internal */
/** @{*/

/**
* @cond RTOS_INTERNAL
*
* @addtogroup rtos
* @{
*
* @defgroup rtos_SysTimer SysTimer class
* @{
*/
Expand Down Expand Up @@ -126,7 +125,6 @@ class SysTimer: private mbed::TimerEvent, private mbed::NonCopyable<SysTimer> {
/**
* @}
* @}
* @endcond
*/

}
Expand Down
5 changes: 5 additions & 0 deletions rtos/TARGET_CORTEX/mbed_boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ extern "C" {

#include "mbed_rtx.h"

/** \ingroup rtos */
/** \addtogroup mbed-os-internal */
/** @{*/

/**
* \defgroup boot Boot sequence
* Boot sequence overview
Expand Down Expand Up @@ -158,6 +162,7 @@ void mbed_sdk_init(void);
*/
void mbed_main(void);

/**@}*/
/**@}*/

#ifdef __cplusplus
Expand Down
35 changes: 25 additions & 10 deletions rtos/TARGET_CORTEX/mbed_rtos_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,48 @@
extern "C" {
#endif

/** \addtogroup rtos */
/** @{*/
#include "rtx_os.h"
#include "mbed_rtx_conf.h"

/** @brief RTOS primitives storage types for RTX
/** \ingroup rtos */
/** \addtogroup mbed-os-internal */
/** @{*/

/** \defgroup rtos_storage RTOS primitives storage types for RTX
Types defined in this file should be utilized, when the direct RTOS C API usage is required, to provide backing memory
for internal RTX data. Allocated object should be wrapped in attribute struct and passed to os*New call, for details
see CMSIS-RTOS2 documentation.
@note
This file breaks abstraction layers and uses RTX internal types, but it limits the contamination to single, RTOS
implementation specific, header file, therefore limiting scope of possible changes.
*/

#include "rtx_os.h"
#include "mbed_rtx_conf.h"
@{
*/

/** RTX Mutex storage */
typedef osRtxMutex_t mbed_rtos_storage_mutex_t;

/** RTX Semaphore storage */
typedef osRtxSemaphore_t mbed_rtos_storage_semaphore_t;

/** RTX Thread storage */
typedef osRtxThread_t mbed_rtos_storage_thread_t;

/** RTX Memory Pool storage */
typedef osRtxMemoryPool_t mbed_rtos_storage_mem_pool_t;

/** RTX Message Queue storage */
typedef osRtxMessageQueue_t mbed_rtos_storage_msg_queue_t;

/** RTX Event Flags storage */
typedef osRtxEventFlags_t mbed_rtos_storage_event_flags_t;

/** RTX Message storage */
typedef osRtxMessage_t mbed_rtos_storage_message_t;

/** RTX Timer storage */
typedef osRtxTimer_t mbed_rtos_storage_timer_t;
/** @}*/
/** @}*/

#define MBED_RTOS_STORAGE_MEM_POOL_MEM_SIZE(block_count, block_size) \
osRtxMemoryPoolMemSize(block_count, block_size)
Expand All @@ -60,5 +77,3 @@ typedef osRtxTimer_t mbed_rtos_storage_timer_t;
#endif

#endif

/** @}*/
4 changes: 2 additions & 2 deletions rtos/TARGET_CORTEX/mbed_rtx_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "mbed_error.h"
#include "mbed_interface.h"
#include "RTX_Config.h"
#include "rtos/rtos_handlers.h"
#include "rtos/rtos_idle.h"
#include "rtos/internal/rtos_handlers.h"
#include "rtos/internal/rtos_idle.h"

#ifdef RTE_Compiler_EventRecorder
#include "EventRecorder.h" // Keil::Compiler:Event Recorder
Expand Down
2 changes: 1 addition & 1 deletion rtos/TARGET_CORTEX/mbed_rtx_idle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SOFTWARE.
*/

#include "rtos/rtos_idle.h"
#include "rtos/internal/rtos_idle.h"
#include "platform/mbed_power_mgmt.h"
#include "TimerEvent.h"
#include "lp_ticker_api.h"
Expand Down
11 changes: 3 additions & 8 deletions rtos/ThisThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@

#include <stdint.h>
#include "cmsis_os2.h"
#include "mbed_rtos1_types.h"
#include "mbed_rtos_storage.h"
#include "platform/Callback.h"
#include "platform/mbed_toolchain.h"
#include "platform/NonCopyable.h"
#include "rtos/Semaphore.h"
#include "rtos/Mutex.h"


namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_ThisThread ThisThread namespace
Expand Down
3 changes: 2 additions & 1 deletion rtos/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
#include "rtos/Mutex.h"

namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup mbed-os-api */
/** @{*/
/**
* \defgroup rtos_Thread Thread class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "rtos/Kernel.h"
#include "rtos/ThisThread.h"

#include "mbed_error.h"
#include "mbed_assert.h"
#include "platform/mbed_error.h"
#include "platform/mbed_assert.h"

namespace rtos {

Expand Down
4 changes: 2 additions & 2 deletions rtos/EventFlags.cpp → rtos/internal/EventFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
#include "rtos/EventFlags.h"
#include <string.h>
#include "mbed_error.h"
#include "mbed_assert.h"
#include "platform/mbed_error.h"
#include "platform/mbed_assert.h"

namespace rtos {

Expand Down
4 changes: 2 additions & 2 deletions rtos/Kernel.cpp → rtos/internal/Kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#include "cmsis_os2.h"
#include "rtos/Kernel.h"
#include "rtos/rtos_idle.h"
#include "rtos/rtos_handlers.h"
#include "rtos_idle.h"
#include "rtos_handlers.h"
#include "platform/mbed_critical.h"

namespace rtos {
Expand Down
4 changes: 2 additions & 2 deletions rtos/Mutex.cpp → rtos/internal/Mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "rtos/Kernel.h"

#include <string.h>
#include "mbed_error.h"
#include "mbed_assert.h"
#include "platform/mbed_error.h"
#include "platform/mbed_assert.h"

namespace rtos {

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion rtos/ThisThread.cpp → rtos/internal/ThisThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "rtos/ThisThread.h"

#include "rtos/Kernel.h"
#include "rtos/rtos_idle.h"
#include "rtos_idle.h"
#include "platform/mbed_assert.h"

namespace rtos {
Expand Down
4 changes: 2 additions & 2 deletions rtos/Thread.cpp → rtos/internal/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
#include "rtos/Thread.h"
#include "rtos/ThisThread.h"
#include "rtos/rtos_idle.h"
#include "rtos/rtos_handlers.h"
#include "rtos_idle.h"
#include "rtos_handlers.h"
#include "platform/mbed_assert.h"
#include "platform/mbed_error.h"

Expand Down
Loading

0 comments on commit f4b986d

Please sign in to comment.