The prosthetic control(MIT)

Committer:
ganlikun
Date:
Thu Jun 23 05:23:34 2022 +0000
Revision:
0:20e0c61e0684
01

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ganlikun 0:20e0c61e0684 1
ganlikun 0:20e0c61e0684 2 /** \addtogroup platform */
ganlikun 0:20e0c61e0684 3 /** @{*/
ganlikun 0:20e0c61e0684 4 /* mbed Microcontroller Library
ganlikun 0:20e0c61e0684 5 * Copyright (c) 2016-2016 ARM Limited
ganlikun 0:20e0c61e0684 6 *
ganlikun 0:20e0c61e0684 7 * Licensed under the Apache License, Version 2.0 (the "License");
ganlikun 0:20e0c61e0684 8 * you may not use this file except in compliance with the License.
ganlikun 0:20e0c61e0684 9 * You may obtain a copy of the License at
ganlikun 0:20e0c61e0684 10 *
ganlikun 0:20e0c61e0684 11 * http://www.apache.org/licenses/LICENSE-2.0
ganlikun 0:20e0c61e0684 12 *
ganlikun 0:20e0c61e0684 13 * Unless required by applicable law or agreed to in writing, software
ganlikun 0:20e0c61e0684 14 * distributed under the License is distributed on an "AS IS" BASIS,
ganlikun 0:20e0c61e0684 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ganlikun 0:20e0c61e0684 16 * See the License for the specific language governing permissions and
ganlikun 0:20e0c61e0684 17 * limitations under the License.
ganlikun 0:20e0c61e0684 18 */
ganlikun 0:20e0c61e0684 19 #ifndef MBED_STATS_H
ganlikun 0:20e0c61e0684 20 #define MBED_STATS_H
ganlikun 0:20e0c61e0684 21 #include <stdint.h>
ganlikun 0:20e0c61e0684 22 #include <stddef.h>
ganlikun 0:20e0c61e0684 23
ganlikun 0:20e0c61e0684 24 #ifdef __cplusplus
ganlikun 0:20e0c61e0684 25 extern "C" {
ganlikun 0:20e0c61e0684 26 #endif
ganlikun 0:20e0c61e0684 27
ganlikun 0:20e0c61e0684 28 typedef struct {
ganlikun 0:20e0c61e0684 29 uint32_t current_size; /**< Bytes allocated currently. */
ganlikun 0:20e0c61e0684 30 uint32_t max_size; /**< Max bytes allocated at a given time. */
ganlikun 0:20e0c61e0684 31 uint32_t total_size; /**< Cumulative sum of bytes ever allocated. */
ganlikun 0:20e0c61e0684 32 uint32_t reserved_size; /**< Current number of bytes allocated for the heap. */
ganlikun 0:20e0c61e0684 33 uint32_t alloc_cnt; /**< Current number of allocations. */
ganlikun 0:20e0c61e0684 34 uint32_t alloc_fail_cnt; /**< Number of failed allocations. */
ganlikun 0:20e0c61e0684 35 } mbed_stats_heap_t;
ganlikun 0:20e0c61e0684 36
ganlikun 0:20e0c61e0684 37 /**
ganlikun 0:20e0c61e0684 38 * Fill the passed in heap stat structure with heap stats.
ganlikun 0:20e0c61e0684 39 *
ganlikun 0:20e0c61e0684 40 * @param stats A pointer to the mbed_stats_heap_t structure to fill
ganlikun 0:20e0c61e0684 41 */
ganlikun 0:20e0c61e0684 42 void mbed_stats_heap_get(mbed_stats_heap_t *stats);
ganlikun 0:20e0c61e0684 43
ganlikun 0:20e0c61e0684 44 typedef struct {
ganlikun 0:20e0c61e0684 45 uint32_t thread_id; /**< Identifier for thread that owns the stack or 0 if multiple threads. */
ganlikun 0:20e0c61e0684 46 uint32_t max_size; /**< Maximum number of bytes used on the stack. */
ganlikun 0:20e0c61e0684 47 uint32_t reserved_size; /**< Current number of bytes allocated for the stack. */
ganlikun 0:20e0c61e0684 48 uint32_t stack_cnt; /**< Number of stacks stats accumulated in the structure. */
ganlikun 0:20e0c61e0684 49 } mbed_stats_stack_t;
ganlikun 0:20e0c61e0684 50
ganlikun 0:20e0c61e0684 51 /**
ganlikun 0:20e0c61e0684 52 * Fill the passed in structure with stack stats accumulated for all threads. The thread_id will be 0
ganlikun 0:20e0c61e0684 53 * and stack_cnt will represent number of threads.
ganlikun 0:20e0c61e0684 54 *
ganlikun 0:20e0c61e0684 55 * @param stats A pointer to the mbed_stats_stack_t structure to fill
ganlikun 0:20e0c61e0684 56 */
ganlikun 0:20e0c61e0684 57 void mbed_stats_stack_get(mbed_stats_stack_t *stats);
ganlikun 0:20e0c61e0684 58
ganlikun 0:20e0c61e0684 59 /**
ganlikun 0:20e0c61e0684 60 * Fill the passed array of stat structures with the stack stats for each available thread.
ganlikun 0:20e0c61e0684 61 *
ganlikun 0:20e0c61e0684 62 * @param stats A pointer to an array of mbed_stats_stack_t structures to fill
ganlikun 0:20e0c61e0684 63 * @param count The number of mbed_stats_stack_t structures in the provided array
ganlikun 0:20e0c61e0684 64 * @return The number of mbed_stats_stack_t structures that have been filled,
ganlikun 0:20e0c61e0684 65 * this is equal to the number of stacks on the system.
ganlikun 0:20e0c61e0684 66 */
ganlikun 0:20e0c61e0684 67 size_t mbed_stats_stack_get_each(mbed_stats_stack_t *stats, size_t count);
ganlikun 0:20e0c61e0684 68
ganlikun 0:20e0c61e0684 69 #ifdef __cplusplus
ganlikun 0:20e0c61e0684 70 }
ganlikun 0:20e0c61e0684 71 #endif
ganlikun 0:20e0c61e0684 72
ganlikun 0:20e0c61e0684 73 #endif
ganlikun 0:20e0c61e0684 74
ganlikun 0:20e0c61e0684 75 /** @}*/
ganlikun 0:20e0c61e0684 76