-
Notifications
You must be signed in to change notification settings - Fork 2
/
segger_wrapper.c
99 lines (76 loc) · 2.26 KB
/
segger_wrapper.c
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
90
91
92
93
94
95
96
97
98
99
/*
* segger_wrapper.c
*
* Created on: 5 oct. 2017
* Author: Vincent
*/
#include "segger_wrapper.h"
#include "task_manager_wrapper.h"
/*******************************************************************************
* Variables
******************************************************************************/
extern sAppErrorDescr m_app_error;
#if USE_SVIEW
static SEGGER_SYSVIEW_MODULE m_module = {
"M=stravaV10",
30,
0,
};
#endif
/*******************************************************************************
* Functions
******************************************************************************/
static uint32_t m_cur_void_id;
void sysview_task_void_enter(uint32_t void_id) {
m_cur_void_id = void_id;
m_app_error.void_id = void_id;
W_SYSVIEW_RecordVoid(m_cur_void_id);
}
void sysview_task_u32_enter(uint32_t void_id, uint32_t data) {
m_cur_void_id = void_id;
m_app_error.void_id = void_id;
W_SYSVIEW_RecordU32(m_cur_void_id, data);
}
void sysview_task_void_exit(uint32_t void_id) {
W_SYSVIEW_RecordEndCall(void_id);
m_cur_void_id = 0;
m_app_error.void_id = 0;
}
/*********************************************************************
*
* segger_init()
*
* Function description
* Record task information.
*/
void segger_init(void) {
//#if USE_RTT && !USE_SVIEW
// // RTT
// SEGGER_RTT_Init();
//#endif
#if USE_SVIEW
#warning "SysView is active"
SEGGER_SYSVIEW_Conf();
SEGGER_SYSVIEW_Start();
SEGGER_SYSVIEW_RegisterModule(&m_module);
#endif
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void segger_sendTaskInfo(uint32_t TaskID, const char* sName, unsigned Prio, uint32_t StackBase, unsigned StackSize) {
#if USE_SVIEW
SEGGER_SYSVIEW_TASKINFO TaskInfo;
memset(&TaskInfo, 0, sizeof(TaskInfo)); // Fill all elements with 0 to allow extending the structure in future version without breaking the code
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
#endif
}