1    /* 
     2     * Copyright (c) 2010, 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    /*!
    35     *  ======== Global ========
    36     *  Global OS Abstract Layer Configuration
    37     */
    38    @Template("./Global.xdt")
    39    
    40    metaonly module Global {
    41    
    42        /*!
    43         *  ======== os ========
    44         *  A specific OSAL implementations "Settings" module, for example,
    45         *  ti.sdo.ce.osal.bios.Settings or ti.sdo.ce.osal.linux.Settings.
    46         *  To set the OS of the executable to BIOS, set Global.os to:
    47         *  xdc.useModule('ti.sdo.ce.osal.bios.Settings').
    48         *
    49         *  When this config param is used, the {@ link ti.sdo.ce.ipc.Settings#ipc
    50         *  config param must also be set.
    51         *
    52         *  This should only be used to explicitly configure the OSAL to
    53         *  a package not provided with Codec Engine.  To use an OSAL provided
    54         *  by Codec Engine, it's recommended to configure the OSAL using
    55         *  the runtimeEnv config param instead of this one.
    56         *
    57         *  See {@ link http://wiki.davincidsp.com/index.php?title=CE_Config_Updates
    58         *  for more details}
    59         *
    60         *  @see runtimeEnv
    61         */
    62        config IOsal.Module os;
    63    
    64        /*!
    65         *  ======== RuntimeOS ========
    66         *  All runtime OSs that are abstracted by this package.
    67         *
    68         *  @see runtimeEnv
    69         */
    70        enum RuntimeEnv {
    71            NONE          = 0,   /*! no OS; threads are not truly supported */
    72            DSPBIOS       = 1,   /*! DSP/BIOS  */
    73            LINUX         = 2,   /*! Linux */
    74            DSPLINK_BIOS  = 3,   /*! DSPLINK + BIOS (DSP) */
    75            DSPLINK_LINUX = 4,   /*! DSPLINK + Linux (Arm) */
    76            WINCE         = 5,   /*! Windows CE */
    77            DSPLINK_WINCE = 6    /*! DSPLINK + Windows CE (Arm) */
    78        };
    79    
    80        /* Arm-side DSPLink configuration - Deprecated!! */
    81    
    82        /*!
    83         *  ======== DEFAULT_ARMDSPLINKCONFIG ========
    84         *  List of DSP memory segments and other parameters for DspLink
    85         *  configuration suitable for most "out of the box" DaVinci
    86         *  DSP servers.
    87         *  Note there must be exactly one segment of each of these types:
    88         *  "main", "system", and "reset".
    89         *
    90         *  Obsolete. This is now part of the ipc module.
    91         *  @_nodoc
    92         */
    93        const ti.sdo.ce.ipc.IIpc.ArmDspLinkConfig
    94            DEFAULT_ARMDSPLINKCONFIG = {
    95            memTable: [
    96                ["DDRALGHEAP", {addr: 0x88000000, size: 0x07A00000, type: "other"}],
    97                ["DDR2",       {addr: 0x8FA00000, size: 0x00400000, type: "main" }],
    98                ["DSPLINKMEM", {addr: 0x8FE00000, size: 0x00100000, type: "link" }],
    99                ["RESETCTRL",  {addr: 0x8FF00000, size: 0x00000080, type: "reset"}],
   100            ],
   101            doPowerControl : false,
   102        };
   103    
   104        /*!
   105         *  ======== armDspLinkConfig ========
   106         *  Arm-side DSPLINK configuration; if left undefined will be set to
   107         *  DEFAULT_ARMDSPLINKCONFIG, but with a warning. OBSOLETE -- used for
   108         *  compatibiility with CE 1.20 Arm app config scripts only; CE2.00 and
   109         *  later scripts should configure individual servers through
   110         *  the same-named field in the Engine instance.
   111         *
   112         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   113         *
   114         *  Obsolete. This is now part of the ipc module.
   115         *  @_nodoc
   116         */
   117        config ti.sdo.ce.ipc.IIpc.ArmDspLinkConfig armDspLinkConfig;
   118    
   119        /*!
   120         *  ======== runtimeEnv ========
   121         *  The runtime OS used to implement the abstractions provided by
   122         *  this package.
   123         *
   124         *  @see RuntimeEnv
   125         */
   126        config RuntimeEnv runtimeEnv;
   127    
   128        /*!
   129         *  ======== defaultMemSegId ========
   130         *  Default ID of the memory segment from which to allocate space
   131         *  (for Memory_alloc/free() calls, as opposed to Memory_segAlloc/Free()).
   132         *  Typically it's the segment where all other code and data go.
   133         *
   134         *  If left as "null", the system will try to find a BIOS segment named
   135         *  "DDR" or "DDR2" and assign its name to this field. In the future
   136         *  this auto-find feature may be removed, so it's best that user .cfg
   137         *  script set this value directly to what they know is appropriate segment.
   138         *
   139         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   140         *  runtimeEnv == DSPLINK_BIOS
   141         */
   142        config String defaultMemSegId = null;
   143    
   144        /*!
   145         *  ======== armCommMsgSize ========
   146         *  Default size for the Arm-DSP communication messages (MSGQ messages).
   147         *
   148         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   149         */
   150        config UInt32 armCommMsgSize = 4 * 1024;
   151    
   152        /*!
   153         *  ======== armCommNumMsgs ========
   154         *  Number of <commMsgSize>-sized messages used for Arm-DSP communication.
   155         *
   156         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   157         */
   158        config UInt32 armCommNumMsgs = 64;
   159    
   160        /*!
   161         *  ======== dspCommNumMsgQueues ========
   162         *  Number of message queues (that can receive and store messages) on the
   163         *  DSP side. Each DSP node (task) needs one message queue.
   164         *
   165         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   166         *  runtimeEnv == DSPLINK_BIOS
   167         */
   168        config UInt32 dspCommNumMsgQueues = 64;
   169    
   170        /*!
   171         *  ======== dspCommUseExactMatch ========
   172         *  Indicates that "exact match" must be used for comm messages allocated
   173         *  on the DSP side.
   174         *
   175         *  Applies only to configurations where runtimeEnv == DSPLINK_BIOS
   176         */
   177        config Bool dspCommUseExactMatch = true;
   178    
   179        /*!
   180         *  ======== dspConfigureMsgqAndPool ========
   181         *  Set to true by default, instructs this module to generate code that
   182         *  configures BIOS MSGQ and POOL modules: symbols MSGQ_config and
   183         *  POOL_config. If set to false, and if BIOS is configured to use MSGQ,
   184         *  user application must define these symbols.
   185         *
   186         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   187         *  runtimeEnv == DSPLINK_BIOS
   188         */
   189        config bool dspConfigureMsgqAndPool = true;
   190    
   191        /*!
   192         *  ======== dspUseMsgqAndPool ========
   193         *  If set to false, instructs Codecs Engine to cut out MSGQ and POOL
   194         *  references completely from the final image.
   195         *
   196         *  Applies only to configurations where runtimeEnv == DSPBIOS.
   197         */
   198        config bool dspUseMsgqAndPool = true;
   199    
   200        /*!
   201         *  ======== dspCommMsgSize ========
   202         *  Default size for the inter-DSP communication messages (MSGQ messages).
   203         *
   204         *  Applies only to configurations where runtimeEnv == DSPBIOS
   205         *  in special circumstances.
   206         *  @_nodoc
   207         */
   208        config UInt32 dspCommMsgSize = 1024;
   209    
   210        /*!
   211         *  ======== dspCommNumMsgs ========
   212         *  Number of <commMsgSize>-sized messages used for Arm-DSP communication.
   213         *
   214         *  Applies only to configurations where runtimeEnv == DSPBIOS
   215         *  in special circumstances.
   216         * @_nodoc
   217         */
   218        config UInt32 dspCommNumMsgs = 64;
   219    
   220        /*!
   221         *  ======== usePowerManagement ========
   222         *  If set to true, will attempt to include power-management code
   223         *  where applicable.
   224         *
   225         *  This feature may not be available on all devices.
   226         * @_nodoc
   227         */
   228        config bool usePowerManagement;
   229    
   230        /*!
   231         *  ======== powerSaveMemoryBlockName ========
   232         *  The name of the segment to which power should be saved; if left null,
   233         *  will default to defaultMemSegId.
   234         *
   235         *  This feature may not be available on all devices.
   236         */
   237        config String powerSaveMemoryBlockName = null;
   238    
   239        /*!
   240         *  ======== useLinkArbiter ========
   241         *  Control flag to indicate if Codec Engine should use the Link Arbiter
   242         *  Daemon (LAD) to arbitrate DSPLINK APIs that need arbitration.  Set to
   243         *  false means LAD should not be used; set to true means LAD should be
   244         *  used.
   245         *
   246         *  This feature may not be available on all devices.
   247         *
   248         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   249         */
   250        config Bool useLinkArbiter = false;
   251    
   252        /*!
   253         *  ======== commLocateRetries ========
   254         *  Number of times to retry Comm_locate() -- to find DSP server's MSGQ --
   255         *  before giving up.
   256         *
   257         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   258         */
   259        config int commLocateRetries = 20;
   260    
   261        /*!
   262         *  ======== traceBufferSize ========
   263         *  Size of the server trace buffer, in MAUs.
   264         *
   265         *  The server trace buffer is a circular buffer of characters written
   266         *  to by clients of ti.sdo.ce.osal.Trace (and ti.sdo.utils.trace.GT) and
   267         *  read by the Engine_*Trace() methods.
   268         *
   269         *  All the trace data in the target memory is stored into a globally
   270         *  visible character buffer
   271         *       Char Global_traceBuffer[ <traceBufferSize> ];
   272         *
   273         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   274         *  runtimeEnv == DSPLINK_BIOS
   275         */
   276        config Int traceBufferSize = 32768;
   277    
   278        /*!
   279         *  ======== enableLogging ========
   280         *  If set to true, enable data generation necessary for CE benchmarking
   281         *  analysis.
   282         *
   283         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   284         *  runtimeEnv == DSPLINK_BIOS
   285         */
   286        config bool enableLogging = true;
   287    
   288        /*!
   289         *  ======== logName ========
   290         *  Name of buffer used for capturing benchmarking data.
   291         *
   292         *  In BIOS environments, this is the name of the BIOS LOG.
   293         *
   294         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   295         *  runtimeEnv == DSPLINK_BIOS
   296         */
   297        config String logName = "ti_sdo_ce_osal_LOG_Buffer";
   298    
   299        /*!
   300         *  ======== logSize ========
   301         *  Size of buffer used for capturing benchmarking data.
   302         *
   303         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   304         *  runtimeEnv == DSPLINK_BIOS
   305         */
   306        config int logSize = 256;
   307    
   308        /*!
   309         *  ======== logType ========
   310         *  Type of buffer used for capturing benchmarking data.
   311         *
   312         *  This can be either "fixed" or "circular".
   313         *
   314         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   315         *  runtimeEnv == DSPLINK_BIOS
   316         */
   317        config String logType = "circular";
   318    
   319        /*!
   320         *  ======== logSeg ========
   321         *  Memory segment for the buffer used for capturing benchmarking data.
   322         *
   323         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   324         *  runtimeEnv == DSPLINK_BIOS
   325         */
   326        config String logSeg = null;
   327    
   328        /*!
   329         *  ======== skipVirtualAddressTranslation ========
   330         *  If set to true, will make Memory_getBufferPhysicalAddress()
   331         *  skip address translation and return the given address as the
   332         *  physical address. Needed when the VISA calls are made with
   333         *  physical buffer addresses instead of virtual ones, specifically
   334         *  in the multi-process-via-kernel-driver case.
   335         *
   336         *  Applies only to environments where virtual memory is used (e.g. Linux)
   337         *  @_nodoc
   338         */
   339        config bool skipVirtualAddressTranslation = false;
   340    
   341        /*!
   342         *  ======== embedBuildInfo ========
   343         *  Indication whether to embed build info (packages and their directories)
   344         *  into the generated executable for debugging/diagnostic purposes.
   345         *  Setting this to 'false' may reduce the static data size by around 1K.
   346         *  Applies to all configurations.
   347         */
   348        config Bool embedBuildInfo = true;
   349    
   350        /*!
   351         *  ======== addObjectToProgramInfoFile ========
   352         *  Internal method for adding an object to an XML-like program info file
   353         *  created alongside the executable
   354         * @_nodoc
   355         */
   356        function addObjectToProgramInfoFile( objName, obj );
   357    
   358        /*!
   359         *  ======== parseInfoFile ========
   360         *  Internal method for parsing an XML-like server program file
   361         *  that lies alongside the executable
   362         * @_nodoc
   363         */
   364        function parseInfoFile( infoFile );
   365    
   366        /*!
   367         *  ======== validate ========
   368         *  Internal validate method (see package.xs)
   369         * @_nodoc
   370         */
   371        function validate();
   372    
   373    }
   374    /*
   375     *  @(#) ti.sdo.ce.osal; 2, 0, 2,424; 9-20-2010 16:41:44; /db/atree/library/trees/ce/ce-r09x/src/ xlibrary
   376    
   377     */
   378