Skip to content

Commit

Permalink
Add prefix to mark cmsis_os functions as private
Browse files Browse the repository at this point in the history
Add a leading underscore to give an indication that the new cmsis_os
API functions are not official.
  • Loading branch information
c1728p9 committed Sep 13, 2016
1 parent 1921b1a commit 9e4a479
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
14 changes: 7 additions & 7 deletions features/frameworks/greentea-client/source/greentea_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ MBED_UNUSED static void send_stack_info()
}

// Print info for all other threads
osThreadEnumId enum_id = osThreadsEnumStart();
osThreadEnumId enum_id = _osThreadsEnumStart();
while (true) {
osThreadId thread_id = osThreadEnumNext(enum_id);
osThreadId thread_id = _osThreadEnumNext(enum_id);
if (NULL == thread_id) {
// End of enumeration
break;
}
enqeue_thread_info(thread_id);
deque_and_print_thread_info();
}
osThreadEnumFree(enum_id);
_osThreadEnumFree(enum_id);

mutex->unlock();
}
Expand All @@ -115,22 +115,22 @@ static void enqeue_thread_info(osThreadId id)
{
osEvent info;
thread_info_t thread_info = {};
info = osThreadGetInfo(id, osThreadInfoEntry);
info = _osThreadGetInfo(id, osThreadInfoEntry);
if (info.status != osOK) {
return;
}
thread_info.entry = (uint32_t)info.value.p;
info = osThreadGetInfo(id, osThreadInfoArg);
info = _osThreadGetInfo(id, osThreadInfoArg);
if (info.status != osOK) {
return;
}
thread_info.arg = (uint32_t)info.value.p;
info = osThreadGetInfo(id, osThreadInfoStackSize);
info = _osThreadGetInfo(id, osThreadInfoStackSize);
if (info.status != osOK) {
return;
}
thread_info.stack_size = (uint32_t)info.value.v;
info = osThreadGetInfo(id, osThreadInfoStackMax);
info = _osThreadGetInfo(id, osThreadInfoStackMax);
if (info.status != osOK) {
return;
}
Expand Down
10 changes: 5 additions & 5 deletions rtos/rtx/TARGET_CORTEX_A/cmsis_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ uint8_t osThreadGetState (osThreadId thread_id);
/// \param[in] info information to read.
/// \return current state of the thread function.
/// \return requested info that includes the status code.
os_InRegs osEvent osThreadGetInfo(osThreadId thread_id, osThreadInfo info);
os_InRegs osEvent _osThreadGetInfo(osThreadId thread_id, osThreadInfo info);

// ==== Generic Wait Functions ====

Expand Down Expand Up @@ -849,16 +849,16 @@ osStatus osMailFree (osMailQId queue_id, void *mail);

/// Start a thread enumeration.
/// \return an enumeration ID or NULL on error.
osThreadEnumId osThreadsEnumStart(void);
osThreadEnumId _osThreadsEnumStart(void);

/// Get the next task ID in the enumeration.
/// \return a thread ID or NULL on if the end of the enumeration has been reached.
osThreadId osThreadEnumNext(osThreadEnumId enum_id);
osThreadId _osThreadEnumNext(osThreadEnumId enum_id);

/// Free the enumeration structure.
/// \param[in] enum_id pointer to the enumeration ID that was obtained with \ref osThreadsEnumStart.
/// \param[in] enum_id pointer to the enumeration ID that was obtained with \ref _osThreadsEnumStart.
/// \return status code that indicates the execution status of the function.
osStatus osThreadEnumFree(osThreadEnumId enum_id);
osStatus _osThreadEnumFree(osThreadEnumId enum_id);

#endif // Thread Enumeration available

Expand Down
8 changes: 4 additions & 4 deletions rtos/rtx/TARGET_CORTEX_A/rt_CMSIS.c
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ uint8_t osThreadGetState (osThreadId thread_id) {
#endif

/// Get the requested info from the specified active thread
os_InRegs osEvent osThreadGetInfo(osThreadId thread_id, osThreadInfo info) {
os_InRegs osEvent _osThreadGetInfo(osThreadId thread_id, osThreadInfo info) {
osEvent ret;
if (__exceptional_mode()) {
ret.status = osErrorISR;
Expand All @@ -1020,14 +1020,14 @@ os_InRegs osEvent osThreadGetInfo(osThreadId thread_id, osThreadInfo info) {
return __svcThreadGetInfo(thread_id, info);
}

osThreadEnumId osThreadsEnumStart() {
osThreadEnumId _osThreadsEnumStart() {
static uint32_t thread_enum_index;
osMutexWait(osMutexId_osThreadMutex, osWaitForever);
thread_enum_index = 0;
return &thread_enum_index;
}

osThreadId osThreadEnumNext(osThreadEnumId enum_id) {
osThreadId _osThreadEnumNext(osThreadEnumId enum_id) {
uint32_t i;
osThreadId id = NULL;
uint32_t *index = (uint32_t*)enum_id;
Expand All @@ -1045,7 +1045,7 @@ osThreadId osThreadEnumNext(osThreadEnumId enum_id) {
return id;
}

osStatus osThreadEnumFree(osThreadEnumId enum_id) {
osStatus _osThreadEnumFree(osThreadEnumId enum_id) {
uint32_t *index = (uint32_t*)enum_id;
*index = 0;
osMutexRelease(osMutexId_osThreadMutex);
Expand Down
10 changes: 5 additions & 5 deletions rtos/rtx/TARGET_CORTEX_M/cmsis_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ uint8_t osThreadGetState (osThreadId thread_id);
/// \param[in] info information to read.
/// \return current state of the thread function.
/// \return requested info that includes the status code.
os_InRegs osEvent osThreadGetInfo(osThreadId thread_id, osThreadInfo info);
os_InRegs osEvent _osThreadGetInfo(osThreadId thread_id, osThreadInfo info);

// ==== Generic Wait Functions ====

Expand Down Expand Up @@ -706,16 +706,16 @@ osStatus osMailFree (osMailQId queue_id, void *mail);

/// Start a thread enumeration.
/// \return an enumeration ID or NULL on error.
osThreadEnumId osThreadsEnumStart(void);
osThreadEnumId _osThreadsEnumStart(void);

/// Get the next task ID in the enumeration.
/// \return a thread ID or NULL on if the end of the enumeration has been reached.
osThreadId osThreadEnumNext(osThreadEnumId enum_id);
osThreadId _osThreadEnumNext(osThreadEnumId enum_id);

/// Free the enumeration structure.
/// \param[in] enum_id pointer to the enumeration ID that was obtained with \ref osThreadsEnumStart.
/// \param[in] enum_id pointer to the enumeration ID that was obtained with \ref _osThreadsEnumStart.
/// \return status code that indicates the execution status of the function.
osStatus osThreadEnumFree(osThreadEnumId enum_id);
osStatus _osThreadEnumFree(osThreadEnumId enum_id);

#endif // Thread Enumeration available

Expand Down
8 changes: 4 additions & 4 deletions rtos/rtx/TARGET_CORTEX_M/rt_CMSIS.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ uint8_t osThreadGetState (osThreadId thread_id) {
#endif

/// Get the requested info from the specified active thread
os_InRegs osEvent osThreadGetInfo(osThreadId thread_id, osThreadInfo info) {
os_InRegs osEvent _osThreadGetInfo(osThreadId thread_id, osThreadInfo info) {
osEvent ret;

if (__get_IPSR() != 0U) { // Not allowed in ISR
Expand All @@ -968,14 +968,14 @@ os_InRegs osEvent osThreadGetInfo(osThreadId thread_id, osThreadInfo info) {
return __svcThreadGetInfo(thread_id, info);
}

osThreadEnumId osThreadsEnumStart() {
osThreadEnumId _osThreadsEnumStart() {
static uint32_t thread_enum_index;
osMutexWait(osMutexId_osThreadMutex, osWaitForever);
thread_enum_index = 0;
return &thread_enum_index;
}

osThreadId osThreadEnumNext(osThreadEnumId enum_id) {
osThreadId _osThreadEnumNext(osThreadEnumId enum_id) {
uint32_t i;
osThreadId id = NULL;
uint32_t *index = (uint32_t*)enum_id;
Expand All @@ -993,7 +993,7 @@ osThreadId osThreadEnumNext(osThreadEnumId enum_id) {
return id;
}

osStatus osThreadEnumFree(osThreadEnumId enum_id) {
osStatus _osThreadEnumFree(osThreadEnumId enum_id) {
uint32_t *index = (uint32_t*)enum_id;
*index = 0;
osMutexRelease(osMutexId_osThreadMutex);
Expand Down

0 comments on commit 9e4a479

Please sign in to comment.