mbed-os5 only for TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Revision:
1:9db0e321a9f4
Parent:
0:5b88d5760320
--- a/rtos/MemoryPool.h	Tue Dec 17 23:23:45 2019 +0000
+++ b/rtos/MemoryPool.h	Tue Dec 31 06:02:27 2019 +0000
@@ -1,5 +1,5 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2019 ARM Limited
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -25,14 +25,19 @@
 #include <stdint.h>
 #include <string.h>
 
-#include "cmsis_os2.h"
-#include "mbed_rtos1_types.h"
-#include "mbed_rtos_storage.h"
+#include "rtos/mbed_rtos_types.h"
+#include "rtos/mbed_rtos1_types.h"
+#include "rtos/mbed_rtos_storage.h"
 #include "platform/NonCopyable.h"
+#include "platform/mbed_assert.h"
+#include "Kernel.h"
 
+
+#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
 namespace rtos {
-/** \addtogroup rtos */
+/** \addtogroup rtos-public-api */
 /** @{*/
+
 /**
  * \defgroup rtos_MemoryPool MemoryPool class
  * @{
@@ -76,7 +81,7 @@
     }
 
     /** Allocate a memory block from a memory pool, without blocking.
-      @return  address of the allocated memory block or NULL in case of no memory available.
+      @return  address of the allocated memory block or nullptr in case of no memory available.
 
       @note You may call this function from ISR context.
     */
@@ -87,7 +92,7 @@
 
     /** Allocate a memory block from a memory pool, optionally blocking.
       @param   millisec  timeout value (osWaitForever to wait forever)
-      @return  address of the allocated memory block or NULL in case of no memory available.
+      @return  address of the allocated memory block or nullptr in case of no memory available.
 
       @note You may call this function from ISR context if the millisec parameter is set to 0.
     */
@@ -98,7 +103,7 @@
 
     /** Allocate a memory block from a memory pool, blocking.
       @param   millisec absolute timeout time, referenced to Kernel::get_ms_count().
-      @return  address of the allocated memory block or NULL in case of no memory available.
+      @return  address of the allocated memory block or nullptr in case of no memory available.
 
       @note You cannot call this function from ISR context.
       @note the underlying RTOS may have a limit to the maximum wait time
@@ -121,14 +126,14 @@
     }
 
     /** Allocate a memory block from a memory pool, without blocking, and set memory block to zero.
-      @return  address of the allocated memory block or NULL in case of no memory available.
+      @return  address of the allocated memory block or nullptr in case of no memory available.
 
       @note You may call this function from ISR context.
     */
     T *calloc(void)
     {
         T *item = alloc();
-        if (item != NULL) {
+        if (item != nullptr) {
             memset(item, 0, sizeof(T));
         }
         return item;
@@ -136,14 +141,14 @@
 
     /** Allocate a memory block from a memory pool, optionally blocking, and set memory block to zero.
       @param   millisec  timeout value (osWaitForever to wait forever)
-      @return  address of the allocated memory block or NULL in case of no memory available.
+      @return  address of the allocated memory block or nullptr in case of no memory available.
 
       @note You may call this function from ISR context if the millisec parameter is set to 0.
     */
     T *calloc_for(uint32_t millisec)
     {
         T *item = alloc_for(millisec);
-        if (item != NULL) {
+        if (item != nullptr) {
             memset(item, 0, sizeof(T));
         }
         return item;
@@ -151,7 +156,7 @@
 
     /** Allocate a memory block from a memory pool, blocking, and set memory block to zero.
       @param   millisec absolute timeout time, referenced to Kernel::get_ms_count().
-      @return  address of the allocated memory block or NULL in case of no memory available.
+      @return  address of the allocated memory block or nullptr in case of no memory available.
 
       @note You cannot call this function from ISR context.
       @note the underlying RTOS may have a limit to the maximum wait time
@@ -162,7 +167,7 @@
     T *calloc_until(uint64_t millisec)
     {
         T *item = alloc_until(millisec);
-        if (item != NULL) {
+        if (item != nullptr) {
             memset(item, 0, sizeof(T));
         }
         return item;
@@ -171,7 +176,7 @@
     /** Free a memory block.
       @param   block  address of the allocated memory block to be freed.
       @return         osOK on successful deallocation, osErrorParameter if given memory block id
-                      is NULL or invalid, or osErrorResource if given memory block is in an
+                      is nullptr or invalid, or osErrorResource if given memory block is in an
                       invalid memory pool state.
 
       @note You may call this function from ISR context.
@@ -188,6 +193,6 @@
 };
 /** @}*/
 /** @}*/
-
 }
 #endif
+#endif