1    /* 
     2     * Copyright (c) 2009, Texas Instruments Incorporated
     3     * All rights reserved.
     4     *
     5     * Use of this software is controlled by the terms and conditions found in
     6     * the New BSD Software License Agreement, which is reproduced in its
     7     * entirity below.
     8     *
     9     * Redistribution and use in source and binary forms, with or without
    10     * modification, are permitted provided that the following conditions
    11     * are met:
    12     *
    13     * *  Redistributions of source code must retain the above copyright
    14     *    notice, this list of conditions and the following disclaimer.
    15     *
    16     * *  Redistributions in binary form must reproduce the above copyright
    17     *    notice, this list of conditions and the following disclaimer in the
    18     *    documentation and/or other materials provided with the distribution.
    19     *
    20     * *  Neither the name of Texas Instruments Incorporated nor the names of
    21     *    its contributors may be used to endorse or promote products derived
    22     *    from this software without specific prior written permission.
    23     *
    24     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    25     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    26     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    27     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    28     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    29     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    30     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    31     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    32     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    33     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    34     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    35     * 
    36     */
    37    
    38    /*!
    39     *  ======== Load.xdc ========
    40     *  Load module.
    41     *
    42     *  The Load module is used for calculating the CPU load of the DSP.
    43     *
    44     *  The Load module provides an API (Load_getcpuload()) that returns the
    45     *  current CPU load.  The CPU load is averaged over a period of time as
    46     *  specified by the 'window' variable within Load.c.
    47     * 
    48     *  It is necessary to do the following in order to use Load_getcpuload()
    49     * 
    50     * (1) A BIOS IDL object which has its function set to '_Load_idlefxn' must
    51     *     exist.  The code to do this has already been written for the user, and
    52     *     exists in 2 different files:
    53     *     
    54     *     a. ti/bios/utils/Load.tci
    55     *     
    56     *         If the user's app is built using Tconf, then this file must be
    57     *         included into the build by adding the following statement into the
    58     *         *.tcf file:
    59     *     
    60     *  @p(code)
    61     *         utils.importFile('Load.tci');
    62     *  @p
    63     *
    64     *     b. ti/bios/utils/package.xs
    65     *     
    66     *         If the user's app is built using RTSC, then one must use the Load
    67     *         module. This is done by adding the following line to the *.cfg file:
    68     *     
    69     *  @p(code)
    70     *         var Load = xdc.useModule('ti.bios.utils.Load');
    71     *  @p
    72     *     
    73     *     NOTE: The two above mentioned methods are mutually exclusive.  One can't
    74     *           use both method 'a' and method 'b' in the same program build, the
    75     *           user must choose the appropriate one for their build.
    76     *
    77     * 
    78     *  (2) call 'Load_init()' from your application's main() program
    79     * 
    80     *  (3) call 'Load_getcpuload()' to return the CPU load as averaged over
    81     *      the pre-compiled window.  This window can be changed by modifying
    82     *      the Load_WINDOW value in this file and recompiling load.c.
    83     * 
    84     *  (4) compile Load.c and link it with your application.
    85     * 
    86     * 
    87     *  CAVEATS:
    88     * 
    89     *  (1) This implementation self-calibrates the shortest path through the
    90     *      IDL loop.  It does this by keeping track of the shortest time between 
    91     *      invocations of 'Load_idlefxn'.  This relies on the fact that the
    92     *      IDL loop will execute at least 2 times in a row w/o being interrupted!
    93     *      In the unlikely event that is a problem for your application, you can
    94     *      measure the shortest path through the IDL loop using the profiler and
    95     *      set 'minloop' to this time.  Note that the units of minloop are
    96     *      CLK_gethtime() units which are processor dependent; e.g., CPU/4 for
    97     *      'C6211, CPU/(TDDR+1) for 'C54xx, CPU for C64P, etc..
    98     */ 
    99    metaonly module Load {
   100    }
   101    
   102    /*
   103     *  ======== Load.xdc ========
   104     *  Load Configuration interface
   105     *!
   106                            (fix for CQSDSCM00018864)
   107     *! 06-Feb-2007 connell added comments for xdoc.
   108     *! 19-Jan-2007 connell created.
   109     */
   110    /*
   111     *  @(#) ti.bios.utils; 2, 0, 2, 02,31; 5-23-2009 17:29:34; /db/vtree/library/trees/biosutils/biosutils-c02x/src/
   112     */
   113