25#define os_trace_isr_enter SEGGER_SYSVIEW_RecordEnterISR
26#define os_trace_isr_exit SEGGER_SYSVIEW_RecordExitISR
27#define os_trace_task_start_exec SEGGER_SYSVIEW_OnTaskStartExec
33#include "../syscfg/syscfg.h"
34#if MYNEWT_VAL(OS_SYSVIEW)
35#include "sysview/vendor/SEGGER_SYSVIEW.h"
39#define OS_TRACE_ID_EVENTQ_PUT (40)
40#define OS_TRACE_ID_EVENTQ_GET_NO_WAIT (41)
41#define OS_TRACE_ID_EVENTQ_GET (42)
42#define OS_TRACE_ID_EVENTQ_REMOVE (43)
43#define OS_TRACE_ID_EVENTQ_POLL_0TIMO (44)
44#define OS_TRACE_ID_EVENTQ_POLL (45)
45#define OS_TRACE_ID_MUTEX_INIT (50)
46#define OS_TRACE_ID_MUTEX_RELEASE (51)
47#define OS_TRACE_ID_MUTEX_PEND (52)
48#define OS_TRACE_ID_SEM_INIT (60)
49#define OS_TRACE_ID_SEM_RELEASE (61)
50#define OS_TRACE_ID_SEM_PEND (62)
51#define OS_TRACE_ID_CALLOUT_INIT (70)
52#define OS_TRACE_ID_CALLOUT_STOP (71)
53#define OS_TRACE_ID_CALLOUT_RESET (72)
54#define OS_TRACE_ID_CALLOUT_TICK (73)
55#define OS_TRACE_ID_MEMBLOCK_GET (80)
56#define OS_TRACE_ID_MEMBLOCK_PUT_FROM_CB (81)
57#define OS_TRACE_ID_MEMBLOCK_PUT (82)
58#define OS_TRACE_ID_MBUF_GET (90)
59#define OS_TRACE_ID_MBUF_GET_PKTHDR (91)
60#define OS_TRACE_ID_MBUF_FREE (92)
61#define OS_TRACE_ID_MBUF_FREE_CHAIN (93)
63#if MYNEWT_VAL(OS_SYSVIEW)
65typedef struct SEGGER_SYSVIEW_MODULE_STRUCT os_trace_module_t;
68os_trace_module_register(os_trace_module_t *m,
const char *name,
69 uint32_t num_events,
void (* send_desc_func)(
void))
73 asprintf(&desc,
"M=%s", name);
75 memset(m, 0,
sizeof(*m));
77 m->NumEvents = num_events;
78 m->pfSendModuleDesc = send_desc_func;
80 SEGGER_SYSVIEW_RegisterModule(m);
82 return m->EventOffset;
86os_trace_module_desc(
const os_trace_module_t *m,
const char *desc)
88 SEGGER_SYSVIEW_RecordModuleDescription(m, desc);
92os_trace_isr_enter(
void)
94 SEGGER_SYSVIEW_RecordEnterISR();
98os_trace_isr_exit(
void)
100 SEGGER_SYSVIEW_RecordExitISR();
104os_trace_task_info(
const struct ble_npl_task *t)
106 SEGGER_SYSVIEW_TASKINFO ti;
108 ti.TaskID = (uint32_t)t;
109 ti.sName = t->t_name;
111 ti.StackSize = t->t_stacksize *
sizeof(os_stack_t);
112 ti.StackBase = (uint32_t)&t->t_stackbottom + ti.StackSize;
114 SEGGER_SYSVIEW_SendTaskInfo(&ti);
118os_trace_task_create(
const struct ble_npl_task *t)
120 SEGGER_SYSVIEW_OnTaskCreate((uint32_t)t);
124os_trace_task_start_exec(
const struct ble_npl_task *t)
126 SEGGER_SYSVIEW_OnTaskStartExec((uint32_t)t);
130os_trace_task_stop_exec(
void)
132 SEGGER_SYSVIEW_OnTaskStopExec();
136os_trace_task_start_ready(
const struct ble_npl_task *t)
138 SEGGER_SYSVIEW_OnTaskStartReady((uint32_t)t);
142os_trace_task_stop_ready(
const struct ble_npl_task *t,
unsigned reason)
144 SEGGER_SYSVIEW_OnTaskStopReady((uint32_t)t, reason);
150 SEGGER_SYSVIEW_OnIdle();
154os_trace_user_start(
unsigned id)
156 SEGGER_SYSVIEW_OnUserStart(
id);
160os_trace_user_stop(
unsigned id)
162 SEGGER_SYSVIEW_OnUserStop(
id);
167#if MYNEWT_VAL(OS_SYSVIEW) && !defined(OS_TRACE_DISABLE_FILE_API)
170os_trace_api_void(
unsigned id)
172 SEGGER_SYSVIEW_RecordVoid(
id);
176os_trace_api_u32(
unsigned id, uint32_t p0)
178 SEGGER_SYSVIEW_RecordU32(
id, p0);
182os_trace_api_u32x2(
unsigned id, uint32_t p0, uint32_t p1)
184 SEGGER_SYSVIEW_RecordU32x2(
id, p0, p1);
188os_trace_api_u32x3(
unsigned id, uint32_t p0, uint32_t p1, uint32_t p2)
190 SEGGER_SYSVIEW_RecordU32x3(
id, p0, p1, p2);
194os_trace_api_ret(
unsigned id)
196 SEGGER_SYSVIEW_RecordEndCall(
id);
200os_trace_api_ret_u32(
unsigned id, uint32_t ret)
202 SEGGER_SYSVIEW_RecordEndCallU32(
id, ret);
207#if !MYNEWT_VAL(OS_SYSVIEW)
210os_trace_isr_enter(
void)
215os_trace_isr_exit(
void)
220os_trace_task_stop_exec(
void)
230os_trace_user_start(
unsigned id)
235os_trace_user_stop(
unsigned id)
241#if !MYNEWT_VAL(OS_SYSVIEW) || defined(OS_TRACE_DISABLE_FILE_API)
244os_trace_api_void(
unsigned id)
249os_trace_api_u32(
unsigned id, uint32_t p0)
254os_trace_api_u32x2(
unsigned id, uint32_t p0, uint32_t p1)
259os_trace_api_u32x3(
unsigned id, uint32_t p0, uint32_t p1, uint32_t p2)
264os_trace_api_ret(
unsigned id)
269os_trace_api_ret_u32(
unsigned id, uint32_t return_value)