1    /*
     2     * Copyright (c) 2012, Texas Instruments Incorporated
     3     * All rights reserved.
     4     *
     5     * Redistribution and use in source and binary forms, with or without
     6     * modification, are permitted provided that the following conditions
     7     * are met:
     8     *
     9     * *  Redistributions of source code must retain the above copyright
    10     *    notice, this list of conditions and the following disclaimer.
    11     *
    12     * *  Redistributions in binary form must reproduce the above copyright
    13     *    notice, this list of conditions and the following disclaimer in the
    14     *    documentation and/or other materials provided with the distribution.
    15     *
    16     * *  Neither the name of Texas Instruments Incorporated nor the names of
    17     *    its contributors may be used to endorse or promote products derived
    18     *    from this software without specific prior written permission.
    19     *
    20     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    21     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    22     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    23     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    24     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    25     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    26     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    27     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    28     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    29     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    30     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    31     * */
    32    
    33    /*
    34     * ======== UIASync.xdc ========
    35     */
    36    import xdc.runtime.Diags;
    37    import ti.uia.events.IUIAEvent;
    38    
    39    /*!
    40     * UIA Synchronization Events
    41     *
    42     *  The UIASync module defines events that enable
    43     *  correlation of events from multiple cores as well as
    44     *  correlation of software events with hardware trace
    45     *
    46     *  The following configuration script demonstrates how to configure an
    47     *  application to log sync point events, using the default configuration
    48     *  settings provided by the LogSync module.  By default, the LogSync module
    49     *  creates a dedicated 256 byte LoggerCircBuf logger to use to capture
    50     *  sync point events.   By default, the Rta module logs sync point events
    51     *  when it receives a start or stop command, or before sending up an
    52     *  event packet if the LogSync.isSyncPointRequired API returns 'true'.
    53     *  @see ti.uia.runtime.LogSync
    54     *
    55     * @a(Examples)
    56     * Example 1: This is part of the XDC configuration file for the application:
    57     *
    58     *  @p(code)
    59     *  // the LogSync module internally does xdc.useModule('ti.uia.events.UIASync')
    60     *  var LogSync = xdc.useModule('ti.uia.runtime.LogSync');
    61     *  var Rta = xdc.useModule('ti.uia.services.Rta');
    62     *  @p
    63     *
    64     *  @p(html)
    65     *  <hr />
    66     *  @p
    67     */
    68    module UIASync inherits IUIAEvent {
    69    
    70        /*!======= syncPoint =======
    71         * syncPoint event
    72         *
    73         * This event logs both a local CPU timestamp (the event timestamp) and a
    74         * global timestamp, which enables time correlation of the
    75         * local CPU timestamps that each event can be tagged with
    76         * against the global timebase, thus enabling multi-core
    77         * event correlation.  It also logs clock information that allows the host
    78         * to determine how to convert CPU timestamp tick counts into time values
    79         * and CPU cycle counts.
    80         * @param(serialNumber) a 32b serial number, used for correlation with HW
    81         *    trace sync points
    82         * @param(CpuTimestampLSW) the 32 LSBs of the global timestamp
    83         * @param(CpuTimestampMSW) the 32 MSBs of the global timestamp
    84         * @param(GlobalTimestampLSW) the 32 LSBs of the global timestamp
    85         * @param(GlobalTimestampMSW) the 32 MSBs of the global timestamp
    86         * @param(CpuCyclesPerCpuTimerTick) the number of CPU cycles per CPU timer
    87         *    increment.  0 if no conversion possible.
    88         * @param(CPUFreqLSW) the 32 LSBs of the CPU frequency
    89         * @param(CPUFreqMSW) the 32 MSBs of the CPU frequency
    90         */
    91        config xdc.runtime.Log.Event syncPoint = {
    92                mask: Diags.ANALYSIS,
    93                msg: "Sync Point:  SerialNumber=0x%x, CpuTStamp [LSW=0x%x, MSW=0x%x], GlobalTStamp [LSW=0x%x, MSW=0x%x], CpuCyclesPerCpuTimerTick=%d, CpuFreq [LSW=0x%x, MSW=0x%x]"};
    94    
    95    
    96        /*!======= syncPointAfterHalt =======
    97         * syncPoint event logged after the CPU has resumed running after being
    98         *   reset, suspended or halted by the debugger
    99         *
   100         * This event logs both a local CPU timestamp (the event timestamp) and a
   101         * global timestamp, which enables time correlation of the
   102         * local CPU timestamps that each event can be tagged with
   103         * against the global timebase, thus enabling multi-core
   104         * event correlation.  It also logs clock information that allows the host
   105         * to determine how to convert CPU timestamp tick counts into time values
   106         *   and CPU cycle counts.
   107         * @param(serialNumber) a 32b serial number, used for correlation with HW
   108         *   trace sync points
   109         * @param(CpuTimestampLSW) the 32 LSBs of the global timestamp
   110         * @param(CpuTimestampMSW) the 32 MSBs of the global timestamp
   111         * @param(GlobalTimestampLSW) the 32 LSBs of the global timestamp
   112         * @param(GlobalTimestampMSW) the 32 MSBs of the global timestamp
   113         * @param(CpuCyclesPerCpuTimerTick) the number of CPU cycles per CPU timer
   114         *   increment.  0 if no conversion possible.
   115         * @param(CPUFreqLSW) the 32 LSBs of the CPU frequency
   116         * @param(CPUFreqMSW) the 32 MSBs of the CPU frequency
   117         */
   118        config xdc.runtime.Log.Event syncPointAfterHalt = {
   119                mask: Diags.ANALYSIS,
   120                msg: "Sync Point After Halt:  SerialNumber=0x%x, CpuTStamp [LSW=0x%x, MSW=0x%x], GlobalTStamp [LSW=0x%x, MSW=0x%x], CpuCyclesPerCpuTimerTick=%d, CpuFreq [LSW=0x%x, MSW=0x%x]"};
   121    
   122        /*!======= globalTimerFreq =======
   123         * syncPoint event containing global timer frequency information
   124         *
   125         * This event logs clock information that allows the host to determine how
   126         * to convert global imestamp tick counts into time values and CPU cycle
   127         * counts.
   128         * @param(serialNumber) a 32b serial number, used for correlation with HW
   129         *    trace sync points
   130         * @param(CpuCyclesPerGlobalTimerTick) the number of CPU cycles per global
   131         *    timer increment.  0 if no conversion possible.
   132         * @param(GlobalTimerFreqLSW) the 32 LSBs of the Global Timer frequency
   133         * @param(GlobalTimerFreqMSW) the 32 MSBs of the Global Timer frequency
   134         */
   135        config xdc.runtime.Log.Event globalTimerFreq = {
   136                mask: Diags.ANALYSIS,
   137                msg: "Sync Point Global Timer Freq:  SerialNumber=0x%x, CpuCyclesPerGlobalTimerTick=%d, GlobalTimerFreq [LSW=0x%x, MSW=0x%x]"};
   138    
   139        /*!======= syncPointUserData =======
   140         * An event that provides supplementary info to a sync point event
   141         *
   142         * This event can be used by user-provided code to log supplementary
   143         * event data whenever a sync point event is logged.
   144         * @param(serialNumber) a 32b serial number, used for correlation with
   145         *    HW trace sync points
   146         * @param(fmt) a format specifier string for up to 6 additional parameters
   147         */
   148        config xdc.runtime.Log.Event syncPointUserProvidedData = {
   149                mask: Diags.ANALYSIS,
   150                msg: "Sync Point User Data: SerialNumber=0x%x, %$S"};
   151    
   152    
   153    }