Skip to content

Commit 21989a3

Browse files
hugueskambaevedon
authored andcommitted
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
1 parent 9c973be commit 21989a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+363
-259
lines changed

drivers/InterruptManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,7 +18,7 @@
1818
#define MBED_INTERRUPTMANAGER_H
1919

2020
#include "cmsis.h"
21-
#include "platform/CallChain.h"
21+
#include "platform/internal/CallChain.h"
2222
#include "platform/PlatformMutex.h"
2323
#include "platform/NonCopyable.h"
2424
#include <string.h>

drivers/RawSerial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#if DEVICE_SERIAL || defined(DOXYGEN_ONLY)
2323

24-
#include "mbed_toolchain.h"
24+
#include "platform/mbed_toolchain.h"
2525
#include "drivers/SerialBase.h"
2626
#include "platform/NonCopyable.h"
2727
#include <cstdarg>

platform/ATCmdParser.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2017 ARM Limited
1+
/* Copyright (c) 2017-2019 ARM Limited
22
* SPDX-License-Identifier: Apache-2.0
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,13 +22,14 @@
2222
#define MBED_ATCMDPARSER_H
2323

2424
#include <cstdarg>
25-
#include "Callback.h"
26-
#include "NonCopyable.h"
27-
#include "FileHandle.h"
25+
#include "platform/Callback.h"
26+
#include "platform/NonCopyable.h"
27+
#include "platform/FileHandle.h"
2828

2929
namespace mbed {
3030

31-
/** \addtogroup platform */
31+
/** \ingroup platform */
32+
/** \addtogroup platform-public-api Public API */
3233
/** @{*/
3334
/**
3435
* \defgroup platform_ATCmdParser ATCmdParser class

platform/CThunk.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
2-
/** \addtogroup platform */
1+
/** \ingroup platform */
2+
/** \addtogroup platform-public-api */
33
/** @{*/
44
/**
55
* \defgroup platform_CThunk CThunk class
@@ -12,7 +12,7 @@
1212
* - supports an optional context parameter for the called function
1313
* - ideally suited for class object receiving interrupts (NVIC_SetVector)
1414
*
15-
* Copyright (c) 2014-2015 ARM Limited
15+
* Copyright (c) 2014-2019 ARM Limited
1616
* SPDX-License-Identifier: Apache-2.0
1717
*
1818
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -39,15 +39,15 @@
3939
#ifndef __CTHUNK_H__
4040
#define __CTHUNK_H__
4141

42-
#include "CThunkBase.h"
42+
#include "platform/internal/CThunkBase.h"
4343

4444
/**
4545
* Class for created a pointer with data bound to it
4646
*
4747
* @note Synchronization level: Not protected
4848
*/
4949
template<class T>
50-
class CThunk: public CThunkBase {
50+
class CThunk: private CThunkBase {
5151
public:
5252
typedef void (T::*CCallbackSimple)(void);
5353
typedef void (T::*CCallback)(void *context);

platform/Callback.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2015 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,7 +24,8 @@
2424
#include "platform/mbed_toolchain.h"
2525

2626
namespace mbed {
27-
/** \addtogroup platform */
27+
/** \ingroup platform */
28+
/** \addtogroup platform-public-api */
2829
/** @{*/
2930
/**
3031
* \defgroup platform_Callback Callback class

platform/CircularBuffer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2015 ARM Limited
2+
* Copyright (c) 2015-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -51,7 +51,8 @@ struct is_unsigned<unsigned long long> {
5151
};
5252
};
5353

54-
/** \addtogroup platform */
54+
/** \ingroup platform */
55+
/** \addtogroup platform-public-api */
5556
/** @{*/
5657
/**
5758
* \defgroup platform_CircularBuffer CircularBuffer functions

platform/CriticalSectionLock.h

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017 ARM Limited
2+
* Copyright (c) 2017-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,12 +18,12 @@
1818
#ifndef MBED_CRITICALSECTIONLOCK_H
1919
#define MBED_CRITICALSECTIONLOCK_H
2020

21-
#include "platform/mbed_critical.h"
2221
#include "platform/mbed_toolchain.h"
2322

2423
namespace mbed {
2524

26-
/** \addtogroup platform */
25+
/** \ingroup platform */
26+
/** \addtogroup platform-public-api */
2727
/** @{*/
2828
/**
2929
* \defgroup platform_CriticalSectionLock CriticalSectionLock functions
@@ -57,15 +57,9 @@ namespace mbed {
5757
*/
5858
class CriticalSectionLock {
5959
public:
60-
CriticalSectionLock()
61-
{
62-
core_util_critical_section_enter();
63-
}
60+
CriticalSectionLock();
6461

65-
~CriticalSectionLock()
66-
{
67-
core_util_critical_section_exit();
68-
}
62+
~CriticalSectionLock();
6963

7064
/** Mark the start of a critical section
7165
* @deprecated This function is inconsistent with RAII and is being removed in the future. Replaced by static function CriticalSectionLock::enable.
@@ -74,10 +68,7 @@ class CriticalSectionLock {
7468
MBED_DEPRECATED_SINCE("mbed-os-5.8",
7569
"This function is inconsistent with RAII and is being removed in the future."
7670
"Replaced by static function CriticalSectionLock::enable.")
77-
void lock()
78-
{
79-
core_util_critical_section_enter();
80-
}
71+
void lock();
8172

8273
/** Mark the end of a critical section
8374
* @deprecated This function is inconsistent with RAII and is being removed in the future. Replaced by static function CriticalSectionLock::enable.
@@ -86,24 +77,15 @@ class CriticalSectionLock {
8677
MBED_DEPRECATED_SINCE("mbed-os-5.8",
8778
"This function is inconsistent with RAII and is being removed in the future."
8879
"Replaced by static function CriticalSectionLock::disable.")
89-
void unlock()
90-
{
91-
core_util_critical_section_exit();
92-
}
80+
void unlock();
9381

9482
/** Mark the start of a critical section
9583
*/
96-
static void enable()
97-
{
98-
core_util_critical_section_enter();
99-
}
84+
static void enable();
10085

10186
/** Mark the end of a critical section
10287
*/
103-
static void disable()
104-
{
105-
core_util_critical_section_exit();
106-
}
88+
static void disable();
10789
};
10890

10991
/**@}*/

platform/DeepSleepLock.h

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2017 ARM Limited
2+
* Copyright (c) 2017-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,12 +18,12 @@
1818
#define MBED_DEEPSLEEPLOCK_H
1919

2020
#include <limits.h>
21-
#include "platform/mbed_power_mgmt.h"
22-
#include "platform/mbed_atomic.h"
21+
#include <stdint.h>
2322

2423
namespace mbed {
2524

26-
/** \addtogroup platform */
25+
/** \ingroup platform */
26+
/** \addtogroup platform-public-api */
2727
/** @{*/
2828
/**
2929
* \defgroup platform_DeepSleepLock DeepSleepLock functions
@@ -49,44 +49,17 @@ class DeepSleepLock {
4949
uint16_t _lock_count;
5050

5151
public:
52-
DeepSleepLock(): _lock_count(1)
53-
{
54-
sleep_manager_lock_deep_sleep();
55-
}
52+
DeepSleepLock();
5653

57-
~DeepSleepLock()
58-
{
59-
if (_lock_count) {
60-
sleep_manager_unlock_deep_sleep();
61-
}
62-
}
54+
~DeepSleepLock();
6355

6456
/** Mark the start of a locked deep sleep section
6557
*/
66-
void lock()
67-
{
68-
uint16_t count = core_util_atomic_incr_u16(&_lock_count, 1);
69-
if (1 == count) {
70-
sleep_manager_lock_deep_sleep();
71-
}
72-
if (0 == count) {
73-
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_OVERFLOW), "DeepSleepLock overflow (> USHRT_MAX)", count);
74-
}
75-
}
58+
void lock();
7659

7760
/** Mark the end of a locked deep sleep section
7861
*/
79-
void unlock()
80-
{
81-
uint16_t count = core_util_atomic_decr_u16(&_lock_count, 1);
82-
if (count == 0) {
83-
sleep_manager_unlock_deep_sleep();
84-
}
85-
if (count == USHRT_MAX) {
86-
core_util_critical_section_exit();
87-
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_UNDERFLOW), "DeepSleepLock underflow (< 0)", count);
88-
}
89-
}
62+
void unlock();
9063
};
9164

9265
/**@}*/

platform/DirHandle.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,12 +18,12 @@
1818
#define MBED_DIRHANDLE_H
1919

2020
#include <stdint.h>
21-
#include "platform/platform.h"
22-
#include "platform/FileHandle.h"
21+
#include "platform/mbed_toolchain.h"
2322
#include "platform/NonCopyable.h"
2423

2524
namespace mbed {
26-
/** \addtogroup platform */
25+
/** \ingroup platform */
26+
/** \addtogroup platform-public-api */
2727
/** @{*/
2828
/**
2929
* \defgroup platform_DirHandle DirHandle functions

platform/FileBase.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,7 +31,8 @@ typedef enum {
3131
FileSystemPathType
3232
} PathType;
3333

34-
/** \addtogroup platform */
34+
/** \ingroup platform */
35+
/** \addtogroup platform-public-api */
3536
/** @{*/
3637
/**
3738
* \defgroup platform_FileBase FileBase class
@@ -72,4 +73,3 @@ class FileBase : private NonCopyable<FileBase> {
7273
} // namespace mbed
7374

7475
#endif
75-

platform/FileHandle.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2017 ARM Limited
2+
* Copyright (c) 2017-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,13 +20,14 @@
2020
typedef int FILEHANDLE;
2121

2222
#include <cstdio>
23-
#include "Callback.h"
23+
#include "platform/Callback.h"
2424
#include "platform/mbed_poll.h"
2525
#include "platform/platform.h"
2626
#include "platform/NonCopyable.h"
2727

2828
namespace mbed {
29-
/** \addtogroup platform */
29+
/** \ingroup platform */
30+
/** \addtogroup platform-public-api */
3031
/** @{*/
3132
/**
3233
* \defgroup platform_FileHandle FileHandle functions

platform/FileLike.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,13 +17,13 @@
1717
#ifndef MBED_FILELIKE_H
1818
#define MBED_FILELIKE_H
1919

20-
#include "platform/mbed_toolchain.h"
2120
#include "platform/FileBase.h"
2221
#include "platform/FileHandle.h"
2322
#include "platform/NonCopyable.h"
2423

2524
namespace mbed {
26-
/** \addtogroup platform */
25+
/** \ingroup platform */
26+
/** \addtogroup platform-public-api */
2727
/** @{*/
2828
/**
2929
* \defgroup platform_FileLike FileLike class

platform/FilePath.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,8 @@
2323
#include "platform/FileLike.h"
2424

2525
namespace mbed {
26-
/** \addtogroup platform */
26+
/** \ingroup platform */
27+
/** \addtogroup platform-public-api */
2728
/** @{*/
2829
/**
2930
* \defgroup platform_FilePath FilePath class

0 commit comments

Comments
 (0)