summaryrefslogtreecommitdiff
path: root/include/debug/object_tracing.h
blob: 010d3ffc8c9af7250985bf442c61c3cc80a12f58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @file
 * @brief APIs used when examining the objects in a debug tracing list.
 */

#ifndef _OBJECT_TRACING_H_
#define _OBJECT_TRACING_H_

#ifdef CONFIG_OBJECT_TRACING

#include <kernel.h>
extern struct k_timer    *_trace_list_k_timer;
extern struct k_mem_slab *_trace_list_k_mem_slab;
extern struct k_mem_pool *_trace_list_k_mem_pool;
extern struct k_sem      *_trace_list_k_sem;
extern struct k_mutex    *_trace_list_k_mutex;
extern struct k_alert    *_trace_list_k_alert;
extern struct k_fifo     *_trace_list_k_fifo;
extern struct k_lifo     *_trace_list_k_lifo;
extern struct k_stack    *_trace_list_k_stack;
extern struct k_msgq     *_trace_list_k_msgq;
extern struct k_mbox     *_trace_list_k_mbox;
extern struct k_pipe     *_trace_list_k_pipe;

extern struct ring_buf   *_trace_list_sys_ring_buf;

/**
 * @def SYS_TRACING_HEAD
 *
 * @brief Head element of a trace list.
 *
 * @details Access the head element of a given trace list.
 *
 * @param type Data type of the trace list to get the head from.
 * @param name Name of the trace list to get the head from.
 */
#define SYS_TRACING_HEAD(type, name) ((type *) _CONCAT(_trace_list_, name))

/**
 * @def SYS_TRACING_NEXT
 *
 * @brief Gets a node's next element.
 *
 * @details Given a node in a trace list, gets the next element
 * in the list.
 *
 * @param type Data type of the trace list
 * @param name Name of the trace list to get the head from.
 * @param obj  Object to get next element from.
 */
#define SYS_TRACING_NEXT(type, name, obj) (((type *)obj)->__next)

#endif /*CONFIG_OBJECT_TRACING*/

#ifdef CONFIG_THREAD_MONITOR

#include <kernel_structs.h>

/**
 * @def SYS_THREAD_MONITOR_HEAD
 *
 * @brief Head element of the thread monitor list.
 *
 * @details Access the head element of the thread monitor list.
 *
 */
#define SYS_THREAD_MONITOR_HEAD ((struct k_thread *)(_kernel.threads))

/**
 * @def SYS_THREAD_MONITOR_NEXT
 *
 * @brief Gets a thread node's next element.
 *
 * @details Given a node in a thread monitor list, gets the next
 * element in the list.
 *
 * @param obj Object to get the next element from.
 */
#define SYS_THREAD_MONITOR_NEXT(obj) (((struct k_thread *)obj)->next_thread)

#endif /*CONFIG_THREAD_MONITOR*/

#endif /*_OBJECT_TRACING_H_*/