Revision aed3754b core/inc/aos_thread.h
core/inc/aos_thread.h | ||
---|---|---|
99 | 99 |
extern "C" { |
100 | 100 |
#endif |
101 | 101 |
void aosThdSleepUntilS(const aos_timestamp_t* t); |
102 |
#if (CH_DBG_FILL_THREADS == TRUE) |
|
103 |
size_t aosThdGetStackPeakUtilization(thread_t* thread); |
|
104 |
#endif |
|
102 | 105 |
#ifdef __cplusplus |
103 | 106 |
} |
104 | 107 |
#endif |
... | ... | |
237 | 240 |
return; |
238 | 241 |
} |
239 | 242 |
|
243 |
/** |
|
244 |
* @brief Retrieve the stack size of a specific thread in bytes. |
|
245 |
* |
|
246 |
* @param[in] thread Thread to retrieve the stack size from. |
|
247 |
* |
|
248 |
* @return Absolute stack size in bytes. |
|
249 |
*/ |
|
250 |
static inline size_t aosThdGetStacksize(thread_t* thread) |
|
251 |
{ |
|
252 |
aosDbgCheck(thread != NULL); |
|
253 |
|
|
254 |
/* |
|
255 |
* Working area is structured like: |
|
256 |
* thread.wabase (LSB)->[ stack | port specific data | thread structure ] |
|
257 |
* See the following macros for details: |
|
258 |
* - THD_WORKING_AREA |
|
259 |
* - THD_WORKING_AREA_SIZE |
|
260 |
* - PORT_WA_SIZE |
|
261 |
*/ |
|
262 |
return ((uintptr_t)(thread) - (uintptr_t)(thread->wabase)) - |
|
263 |
((size_t)PORT_GUARD_PAGE_SIZE + sizeof(struct port_intctx) + sizeof(struct port_extctx) + (size_t)PORT_INT_REQUIRED_STACK); |
|
264 |
} |
|
265 |
|
|
240 | 266 |
#endif /* _AMIROOS_THREAD_H_ */ |
241 | 267 |
|
242 | 268 |
/** @} */ |
Also available in: Unified diff