1    /*
     2     * Copyright (c) 2012-2014, 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     * ======== TimestampC66XGlobal.xdc ========
    35     */
    36    package ti.uia.family.c66;
    37    
    38    import xdc.runtime.Types;
    39    
    40    /*!
    41     *  ======== TimestampC66XGlobal.xdc ========
    42     *  Implementation of `{@link ITimestampProvider}` using the 64b emulation counter
    43     *   in the PLL Ctrl module
    44     */
    45    @ModuleStartup
    46    module TimestampC66XGlobal inherits ti.uia.runtime.IUIATimestampProvider {
    47    
    48    
    49        /*!
    50         * ======== timerBaseAdrs ========
    51         * Base address of the timer to be used as the global timer that provides
    52         *  a common time reference for all CPUs.
    53         *
    54         * This timer will be used to enable multicore event correlation.
    55         */
    56        config UInt32 timerBaseAdrs = 0x023101F0;
    57    
    58        /*!
    59         * ======== maxTimerClockFreq =========
    60         * The highest timer clock frequency.
    61         *
    62         * The default ticks per second rate of the timer is calculated by dividing
    63         * the timer's bus clock frequency by the cyclesPerTick config parameter.
    64         * By default, this will be set to the 1/4 the CPU speed defined in the Platform.xdc
    65         * file that is part of the platform specified in the build settings.
    66         *
    67         * @a(Examples)
    68         * Example: The following is an example of the configuration script used
    69         * to configure the frequency for a value of 200 MHz,
    70         * and assigns it to the LogSync module so that it can
    71         * be used to enable multicore event correlation.
    72         * @p(code)
    73         * var TimestampC66XGlobal = xdc.useModule('ti.uia.family.c66.TimestampC66XGlobal');
    74         * TimestampC66XGlobal.maxTimerClockFreq = {lo:200000000,hi:0};
    75         * var LogSync = xdc.useModule('ti.uia.runtime.LogSync');
    76         * LogSync.GlobalTimestampProxy = TimestampC66XGlobal;
    77         * @p
    78         *
    79         */
    80        override config Types.FreqHz maxTimerClockFreq;
    81    
    82    
    83        /*!
    84         * ======== maxBusClockFreq =========
    85         * The highest bus clock frequency used to drive the timer.
    86         *
    87         * By default, the timer's bus clock frequency will be set to the CPU speed
    88             * defined in the Platform.xdc file that is part of the platform specified
    89             * in the build settings.
    90         *
    91         * @a(Examples)
    92         * Example: The following is an example of the configuration script used
    93         * to configure the frequency for a value of 1.2 GHz:
    94         * @p(code)
    95         * var TimestampC66XGlobal = xdc.useModule('ti.uia.family.c66.TimestampC66XGlobal');
    96         * TimestampC66XGlobal.maxTimerClockFreq = {lo:1200000000,hi:0};
    97         * @p
    98         */
    99        override config Types.FreqHz maxBusClockFreq;
   100    
   101        /*!
   102         * ======== canFrequencyBeChanged =========
   103         * Indicates whether the timer frequency can be changed or not
   104         *
   105         * @a(returns) true if the timer's clock frequency can be changed
   106         */
   107        override metaonly config Bool canFrequencyBeChanged = false;
   108    
   109        /*!
   110         * ======== cpuCyclesPerTick =========
   111         * The number of CPU cycles each tick of the timestamp corresponds to
   112         *
   113         * A value of 0 indicates that no conversion between the timer's tick count
   114         * and CPU cycles is possible.
   115         */
   116        override metaonly config UInt32 cpuCyclesPerTick = 4;
   117    
   118    
   119        /*!
   120         * ======== canCpuCyclesPerTickBeChanged =========
   121         * Indicates whether the timer's cycles per tick divide down ratio can be
   122         *    changed or not
   123         *
   124         * @a(returns) true if the timer's CPU cycles per tick can be changed
   125         */
   126        override metaonly config Bool canCpuCyclesPerTickBeChanged = false;
   127        /*!
   128         *  ======== get32 ========
   129         *  Return a 32-bit timestamp
   130         *
   131         *  @a(returns)
   132         *  Returns a 32-bit timestamp value.
   133         *  Use `{@link #getFreq}` to convert this value into units of real time.
   134         *
   135         *  @see #get64
   136         */
   137        @DirectCall
   138        override Bits32 get32();
   139    
   140        /*!
   141         *  ======== get64 ========
   142         *  Return a 64-bit timestamp
   143         *
   144         *  @param(result)  pointer to 64-bit result
   145         *
   146         *      This parameter is a pointer to a structure representing a 64-bit
   147         *      wide timestamp value where the current timestamp is written.
   148         *
   149         *      If the underlying hardware does not support 64-bit resolution, the
   150         *      `hi` field of `result` is always set to 0; see
   151         *      `{@link xdc.runtime.Types#Timestamp64}`.  So, it is possible for
   152         *      the `lo` field to wrap around without any change to the `hi` field.
   153         *      Use `{@link #getFreq}` to convert this value into units of real
   154         *      time.
   155         *
   156         *  @see #get32
   157         */
   158        @DirectCall
   159        override Void get64(Types.Timestamp64 *result);
   160    
   161        /*!
   162         *  ======== getFreq ========
   163         *  Get the timestamp timer's frequency (in Hz)
   164         *
   165         *  @param(freq)  pointer to a 64-bit result
   166         *
   167         *      This parameter is a pointer to a structure representing a 64-bit
   168         *      wide frequency value where the timer's frequency (in Hz)
   169         *      is written; see `{@link xdc.runtime.Types#FreqHz}`.
   170         *      This function provides a way of converting timestamp
   171         *      values into units of real time.
   172         *
   173         *  @see #get32
   174         *  @see #get64
   175         */
   176        @DirectCall
   177        override Void getFreq(Types.FreqHz *freq);
   178    
   179        /*!
   180         *  ======== setFreq ========
   181         *  Set the timestamp timer's frequency (in Hz)
   182         *
   183         *  @param(freq)  pointer to a 64-bit input value
   184         *
   185         *      This parameter is a pointer to a structure representing a 64-bit
   186         *      wide frequency value where the timer's frequency (in Hz)
   187         *      is written; see `{@link xdc.runtime.Types#FreqHz}`.
   188         *      This function provides a way of updating the timestamp
   189         *      data that is logged with a sync point event.
   190         *
   191         *  @see #getFreq
   192         */
   193        @DirectCall
   194        Void setFreq(Types.FreqHz *freq);
   195    
   196    instance:
   197    
   198    
   199    internal:
   200        struct Module_State {
   201            Types.FreqHz freq;
   202        };
   203    }