/********************************************************************* * SEGGER Microcontroller GmbH * * The Embedded Experts * ********************************************************************** * * * (c) 1995 - 2019 SEGGER Microcontroller GmbH * * * * www.segger.com Support: support@segger.com * * * ********************************************************************** * * * SEGGER SystemView * Real-time application analysis * * * ********************************************************************** * * * All rights reserved. * * * * SEGGER strongly recommends to not make any changes * * to or modify the source code of this software in order to stay * * compatible with the SystemView and RTT protocol, and J-Link. * * * * Redistribution and use in source and binary forms, with or * * without modification, are permitted provided that the following * * condition is met: * * * * o Redistributions of source code must retain the above copyright * * notice, this condition and the following disclaimer. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * * DAMAGE. * * * ********************************************************************** * * * SystemView version: 3.30 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW_AliOSThings.c Purpose : Interface between AliOS Things and SystemView. Revision: $Rev: 7947 $ */ #include "k_api.h" #include "SEGGER_SYSVIEW.h" /********************************************************************* * * _cbSendTaskList() * * Function description * This function is part of the link between FreeRTOS and SYSVIEW. * Called from SystemView when asked by the host, it uses SYSVIEW * functions to send the entire task list to the host. */ static void _cbSendTaskList(void) { klist_t *taskhead = &g_kobj_list.task_head; klist_t *taskend = taskhead; klist_t *tmp; ktask_t *task; krhino_sched_disable(); for (tmp = taskhead->next; tmp != taskend; tmp = tmp->next) { task = krhino_list_entry(tmp, ktask_t, task_stats_item); SYSVIEW_SendTaskInfo((U32)task, task->task_name, task->prio, (U32)task->task_stack_base, task->stack_size); } krhino_sched_enable(); } /********************************************************************* * * _cbGetTime() * * Function description * This function is part of the link between FreeRTOS and SYSVIEW. * Called from SystemView when asked by the host, returns the * current system time in micro seconds. */ static U64 _cbGetTime(void) { return aos_now_ms(); } /********************************************************************* * * Global functions * ********************************************************************** */ /********************************************************************* * * SYSVIEW_SendTaskInfo() * * Function description * Record task information. */ void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) { 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); } /********************************************************************* * * Public API structures * ********************************************************************** */ // Callbacks provided to SYSTEMVIEW by FreeRTOS const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = { _cbGetTime, _cbSendTaskList, }; /*************************** End of file ****************************/