/*********************************************************************
*                    SEGGER Microcontroller GmbH                     *
*                        The Embedded Experts                        *
**********************************************************************
*                                                                    *
*            (c) 1995 - 2021 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_Config_uCOSII.c
Purpose : Sample setup configuration of SystemView with Micrium
          uC/OS-II.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include "os.h"
#include "cpu_core.h"

#if (defined(OS_TRACE_EN) && (OS_TRACE_EN > 0u))

extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;

CPU_ERR  local_err;

/*********************************************************************
*
*       Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME        "ARM Cortex-M Demo"

// The target device name
#define SYSVIEW_DEVICE_NAME     "Cortex-M Device"


#include "drv_clk.h"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
//#define SYSVIEW_TIMESTAMP_FREQ  (CPU_TS_TmrFreqGet(&local_err))
#define SYSVIEW_TIMESTAMP_FREQ  (CLOCK_SYS_FREQ)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
//#define SYSVIEW_CPU_FREQ        (CPU_TS_TmrFreqGet(&local_err))
#define SYSVIEW_CPU_FREQ        (CLOCK_SYS_FREQ)
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE        (0x20000000)

/*********************************************************************
*
*       _cbSendSystemDesc()
*
*  Function description
*    Sends SystemView description strings.
*/
//ฑเบละ่าช+16
static void _cbSendSystemDesc(void) 
{
    SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=uCOS-II");
    SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
    SEGGER_SYSVIEW_SendSysDesc("I#35=CAN1_TX");
    SEGGER_SYSVIEW_SendSysDesc("I#36=CAN1_RX");
    SEGGER_SYSVIEW_SendSysDesc("I#53=UART1");
    SEGGER_SYSVIEW_SendSysDesc("I#54=UART2");
    SEGGER_SYSVIEW_SendSysDesc("I#55=UART3");
    SEGGER_SYSVIEW_SendSysDesc("I#68=UART4");
    SEGGER_SYSVIEW_SendSysDesc("I#69=UART5");
    SEGGER_SYSVIEW_SendSysDesc("I#87=UART6");
    SEGGER_SYSVIEW_SendSysDesc("I#98=UART7");
    SEGGER_SYSVIEW_SendSysDesc("I#79=CAN2_TX");
    SEGGER_SYSVIEW_SendSysDesc("I#80=CAN2_RX");  
    SEGGER_SYSVIEW_SendSysDesc("I#77=ETH");
    
    SYSVIEW_SendResourceList();
}
/*********************************************************************
*
*       Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
  SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
                      &SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
  SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}

#endif

/*************************** End of file ****************************/
