drivers/segger: add heap note support
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com> Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
parent
001de69be9
commit
f61bfd5608
@ -73,6 +73,11 @@ static void note_sysview_syscall_enter(FAR struct note_driver_s *drv,
|
||||
static void note_sysview_syscall_leave(FAR struct note_driver_s *drv,
|
||||
int nr, uintptr_t result);
|
||||
#endif
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_HEAP
|
||||
static void note_sysview_heap(FAR struct note_driver_s *drv,
|
||||
uint8_t event, FAR void *heap, FAR void *mem,
|
||||
size_t size);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -113,6 +118,9 @@ static const struct note_driver_ops_s g_note_sysview_ops =
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
|
||||
note_sysview_irqhandler, /* irqhandler */
|
||||
#endif
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_HEAP
|
||||
note_sysview_heap, /* heap */
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct note_sysview_driver_s g_note_sysview_driver =
|
||||
@ -319,6 +327,28 @@ static void note_sysview_syscall_leave(FAR struct note_driver_s *drv,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_HEAP
|
||||
static void note_sysview_heap(FAR struct note_driver_s *drv,
|
||||
uint8_t event, FAR void *heap, FAR void *mem,
|
||||
size_t size)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case NOTE_HEAP_ALLOC:
|
||||
SEGGER_SYSVIEW_HeapAlloc(heap, mem, size);
|
||||
break;
|
||||
case NOTE_HEAP_FREE:
|
||||
SEGGER_SYSVIEW_HeapFree(heap, mem);
|
||||
break;
|
||||
case NOTE_HEAP_ADD:
|
||||
SEGGER_SYSVIEW_HeapDefine(heap, mem, size, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user