1    /* 
     2     * Copyright (c) 2009, 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         *  Obsolete. This should now be set through osal.bios.Settings.
   143         *  @_nodoc
   144         */
   145        config String defaultMemSegId = null;
   146    
   147        /*!
   148         *  ======== armCommMsgSize ========
   149         *  Default size for the Arm-DSP communication messages (MSGQ messages).
   150         *
   151         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   152         *
   153         *  Obsolete. This should now be set through ipc.Settings.
   154         *  @_nodoc
   155         */
   156        config UInt32 armCommMsgSize = 4 * 1024;
   157    
   158        /*!
   159         *  ======== armCommNumMsgs ========
   160         *  Number of <commMsgSize>-sized messages used for Arm-DSP communication.
   161         *
   162         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   163         *
   164         *  Obsolete. This should now be set through ipc.Settings.
   165         *  @_nodoc
   166         */
   167        config UInt32 armCommNumMsgs = 64;
   168    
   169        /*!
   170         *  ======== dspCommNumMsgQueues ========
   171         *  Number of message queues (that can receive and store messages) on the
   172         *  DSP side. Each DSP node (task) needs one message queue.
   173         *
   174         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   175         *  runtimeEnv == DSPLINK_BIOS
   176         *
   177         *  Obsolete. This should now be set through ipc.Settings.
   178         *  @_nodoc
   179         */
   180        config UInt32 dspCommNumMsgQueues = 64;
   181    
   182        /*!
   183         *  ======== dspCommUseExactMatch ========
   184         *  Indicates that "exact match" must be used for comm messages allocated on
   185         *  the DSP side.
   186         *
   187         *  Applies only to configurations where runtimeEnv == DSPLINK_BIOS
   188         *
   189         *  Obsolete. This should now be set through ipc.Settings.
   190         *  @_nodoc
   191         */
   192        config Bool dspCommUseExactMatch = true;
   193    
   194        /*!
   195         *  ======== dspConfigureMsgqAndPool ========
   196         *  Set to true by default, instructs this module to generate code that
   197         *  configures BIOS MSGQ and POOL modules: symbols MSGQ_config and
   198         *  POOL_config. If set to false, and if BIOS is configured to use MSGQ,
   199         *  user application must define these symbols.
   200         *
   201         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   202         *  runtimeEnv == DSPLINK_BIOS
   203         *
   204         *  Obsolete. This should now be set through ipc.Settings.
   205         *  @_nodoc
   206         */
   207        config bool dspConfigureMsgqAndPool = true;
   208    
   209        /*!
   210         *  ======== dspUseMsgqAndPool ========
   211         *  If set to false, instructs Codecs Engine to cut out MSGQ and POOL
   212         *  references completely from the final image.
   213         *
   214         *  Applies only to configurations where runtimeEnv == DSPBIOS.
   215         *
   216         *  Obsolete. This should now be set through ipc.Settings.
   217         *  @_nodoc
   218         */
   219        config bool dspUseMsgqAndPool = true;
   220    
   221        /*!
   222         *  ======== dspCommMsgSize ========
   223         *  Default size for the inter-DSP communication messages (MSGQ messages).
   224         *
   225         *  Applies only to configurations where runtimeEnv == DSPBIOS
   226         *  in special circumstances.
   227         *
   228         *  Obsolete. This should now be set through ipc.Settings.
   229         *  @_nodoc
   230         */
   231        config UInt32 dspCommMsgSize = 1024;
   232    
   233        /*!
   234         *  ======== dspCommNumMsgs ========
   235         *  Number of <commMsgSize>-sized messages used for Arm-DSP communication.
   236         *
   237         *  Applies only to configurations where runtimeEnv == DSPBIOS
   238         *  in special circumstances.
   239         *
   240         *  Obsolete. This should now be set through ipc.Settings.
   241         *  @_nodoc
   242         */
   243        config UInt32 dspCommNumMsgs = 64;
   244    
   245        /*!
   246         *  ======== usePowerManagement ========
   247         *  If set to true, will attempt to include power-management code
   248         *  where applicable.
   249         *
   250         *  This feature may not be available on all devices.
   251         *
   252         *  Obsolete. This should now be set through ipc.Settings.
   253         *  @_nodoc
   254         */
   255        config bool usePowerManagement;
   256    
   257        /*!
   258         *  ======== powerSaveMemoryBlockName ========
   259         *  The name of the segment to which power should be saved; if left null,
   260         *  will default to defaultMemSegId.
   261         *
   262         *  This feature may not be available on all devices.
   263         *
   264         *  Obsolete. This should now be set through ipc.Settings.
   265         *  @_nodoc
   266         */
   267        config String powerSaveMemoryBlockName = null;
   268    
   269        /*!
   270         *  ======== useLinkArbiter ========
   271         *  Control flag to indicate if Codec Engine should use the Link Arbiter
   272         *  Daemon (LAD) to arbitrate DSPLINK APIs that need arbitration.  Set to
   273         *  false means LAD should not be used; set to true means LAD should be
   274         *  used.
   275         *
   276         *  This feature may not be available on all devices.
   277         *
   278         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   279         *
   280         *  Obsolete. This should now be set through ipc.Settings.
   281         *  @_nodoc
   282         */
   283        config Bool useLinkArbiter = false;
   284    
   285        /*!
   286         *  ======== commLocateRetries ========
   287         *  number of times to retry Comm_locate() -- to find DSP server's MSGQ --
   288         *  before giving up.
   289         *
   290         *  Applies only to configurations where runtimeEnv == DSPLINK_LINUX
   291         *
   292         *  Obsolete. This should now be set through ipc.Settings.
   293         *  @_nodoc
   294         */
   295        config int commLocateRetries = 20;
   296    
   297        /*!
   298         *  ======== traceBufferSize ========
   299         *  Size of the server trace buffer, in MAUs.
   300         *
   301         *  The server trace buffer is a circular buffer of characters written
   302         *  to by clients of ti.sdo.ce.osal.Trace (and ti.sdo.utils.trace.GT) and
   303         *  read by the Engine_*Trace() methods.
   304         *
   305         *  All the trace data in the target memory is stored into a globally
   306         *  visible character buffer
   307         *       Char Global_traceBuffer[ <traceBufferSize> ];
   308         *
   309         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   310         *  runtimeEnv == DSPLINK_BIOS
   311         *
   312         *  Obsolete. This should now be set through osal.bios.Settings.
   313         *  @_nodoc
   314         */
   315        config Int traceBufferSize = 32768;
   316    
   317        /*!
   318         *  ======== enableLogging ========
   319         *  If set to true, enable data generation necessary for CE benchmarking
   320         *  analysis.
   321         *
   322         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   323         *  runtimeEnv == DSPLINK_BIOS
   324         *
   325         *  Obsolete. This should now be set through osal.bios.Settings.
   326         *  @_nodoc
   327         */
   328        config bool enableLogging = true;
   329    
   330        /*!
   331         *  ======== logName ========
   332         *  Name of buffer used for capturing benchmarking data.
   333         *
   334         *  In BIOS environments, this is the name of the BIOS LOG.
   335         *
   336         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   337         *  runtimeEnv == DSPLINK_BIOS
   338         *
   339         *  Obsolete. This should now be set through osal.bios.Settings.
   340         *  @_nodoc
   341         */
   342        config String logName = "ti_sdo_ce_osal_LOG_Buffer";
   343    
   344        /*!
   345         *  ======== logSize ========
   346         *  Size of buffer used for capturing benchmarking data.
   347         *
   348         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   349         *  runtimeEnv == DSPLINK_BIOS
   350         *
   351         *  Obsolete. This should now be set through osal.bios.Settings.
   352         *  @_nodoc
   353         */
   354        config int logSize = 256;
   355    
   356        /*!
   357         *  ======== logType ========
   358         *  Type of buffer used for capturing benchmarking data.
   359         *
   360         *  This can be either "fixed" or "circular".
   361         *
   362         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   363         *  runtimeEnv == DSPLINK_BIOS
   364         *
   365         *  Obsolete. This should now be set through osal.bios.Settings.
   366         *  @_nodoc
   367         */
   368        config String logType = "circular";
   369    
   370        /*!
   371         *  ======== logSeg ========
   372         *  Memory segment for the buffer used for capturing benchmarking data.
   373         *
   374         *  Applies only to configurations where runtimeEnv == DSPBIOS or
   375         *  runtimeEnv == DSPLINK_BIOS
   376         *
   377         *  Obsolete. This should now be set through osal.bios.Settings.
   378         *  @_nodoc
   379         */
   380        config String logSeg = null;
   381    
   382        /*!
   383         *  ======== skipVirtualAddressTranslation ========
   384         *  If set to true, will make Memory_getBufferPhysicalAddress()
   385         *  skip address translation and return the given address as the
   386         *  physical address. Needed when the VISA calls are made with
   387         *  physical buffer addresses instead of virtual ones, specifically
   388         *  in the multi-process-via-kernel-driver case.
   389         *
   390         *  Applies only to environments where virtual memory is used (e.g. Linux)
   391         *  @_nodoc
   392         */
   393        config bool skipVirtualAddressTranslation = false;
   394    
   395        /*!
   396         *  ======== embedBuildInfo ========
   397         *  Indication whether to embed build info (packages and their directories)
   398         *  into the generated executable for debugging/diagnostic purposes.
   399         *  Setting this to 'false' may reduce the static data size by around 1K.
   400         *  Applies to all configurations.
   401         */
   402        config Bool embedBuildInfo = true;
   403    
   404        /*!
   405         *  ======== addObjectToProgramInfoFile ========
   406         *  Internal method for adding an object to an XML-like program info file
   407         *  created alongside the executable
   408         * @_nodoc
   409         */
   410        function addObjectToProgramInfoFile( objName, obj );
   411    
   412        /*!
   413         *  ======== parseInfoFile ========
   414         *  Internal method for parsing an XML-like server program file
   415         *  that lies alongside the executable
   416         * @_nodoc
   417         */
   418        function parseInfoFile( infoFile );
   419    
   420        /*!
   421         *  ======== validate ========
   422         *  Internal validate method (see package.xs)
   423         * @_nodoc
   424         */
   425        function validate();
   426    
   427    }
   428    /*
   429     *  @(#) ti.sdo.ce.osal; 2, 0, 2,382; 11-18-2009 14:12:54; /db/atree/library/trees/ce/ce-o05x/src/
   430     */
   431