1    /*
     2     *  Copyright 2008 by Texas Instruments Incorporated.
     3     *
     4     *  All rights reserved. Property of Texas Instruments Incorporated.
     5     *  Restricted rights to use, duplicate or disclose this code are
     6     *  granted through contract.
     7     *
     8     */
     9    
    10    /*!
    11     *  ======== Server ========
    12     *  DSP Server Configuration interface
    13     */
    14    @Template("./Server.xdt")
    15    
    16    metaonly module Server
    17    {
    18        /*!
    19         *  ======== MINPRI ========
    20         *  Minimum priority that a thread can assume
    21         *
    22         *  All threads must have a priority value greater than or equal to
    23         *  {@link #MINPRI Server.MINPRI} and less than or equal to
    24         *  {@link #MAXPRI Server.MAXPRI}.
    25         */
    26        readonly config Int MINPRI = 1;
    27    
    28        /*!
    29         *  ======== MAXPRI ========
    30         *  Maximum priority that a thread can assume
    31         *
    32         *  All threads must have a priority value greater than or equal to
    33         *  {@link #MINPRI Server.MINPRI} and less than or equal to
    34         *  {@link #MAXPRI Server.MAXPRI}.
    35         */
    36        readonly config Int MAXPRI = 15;
    37    
    38        /*!
    39         *  ======== ThreadAttrs ========
    40         *  Thread attributes
    41         *
    42         *  This structure defines the thread attrubutes for any threads created
    43         *  by the RMS thread; see Server.threadAttrs.
    44         */
    45        struct ThreadAttrs {
    46            Int stackSize;      /*! minimum stack size required for this thread */
    47            Int stackMemId;     /*! MEM seg id for the thread's stack */
    48            Int priority;       /*! priority of the thread */
    49        };
    50    
    51        /*!
    52         *  ======== AlgDesc ========
    53         *  Algorithm descriptor
    54         *
    55         *  This structure describes the execution context provided by
    56         *  the server for an algorithm module.
    57         *
    58         *  @field(name)    This string specifies the "local" name used by the
    59         *                  server to generate instance names
    60         *  @field(mod)     This field is a module reference that identifies the
    61         *                  actual module implementing the algorithm to instantiate.
    62         *                  This module reference is often acquired by a call to
    63         *                  `xdc.useModule();` like this:
    64         *                  @p(code)
    65         *                      modReference = xdc.useModule('package.Module');
    66         *                  @p
    67         *  @field(threadAttrs)  This structure defines attributes of the "server"
    68         *                  thread that will handle instance processing
    69         *                  requests; e.g., stack size and priority.
    70         *                  @p(blist)
    71         *                  -{@link #ThreadAttrs threadAttrs.stackSize}:  This
    72         *                      field is optional when configuring
    73         *                      an algorithm in a server, though strongly
    74         *                      recommended.  Stack overrun is a very common
    75         *                      cause of system instability.  If it's not supplied
    76         *                      by the server integrator's script, the stack size
    77         *                      returned by the codec's
    78         *                      {@link ICodec#getStackSize()} method will be
    79         *                      added to the value of
    80         *                      {@link #stackSizePad stackSizePad}.
    81         *                  -{@link #ThreadAttrs threadAttrs.stackMemId}:  This
    82         *                      field is required when configuring
    83         *                      an algorithm in a server.
    84         *                  -{@link #ThreadAttrs threadAttrs.priority}:  This
    85         *                      field is optional (though strongly recommended)
    86         *                       when configuring an algorithm in a server.
    87         *                      If it's not supplied by the server integrator's
    88         *                      script, a default priority will be assigned, and a
    89         *                      remark will be printed to the console during server
    90         *                      configuration to indicate which priority was
    91         *                      assigned to the algorithm.  Note that this priority
    92         *                      can be overridden at runtime by the application;
    93         *                      see the various `*_create()` VISA APIs for more
    94         *                      details.
    95         *                  @p
    96         *  @field(groupId) This id specifies which resource sharing group
    97         *                  this codec will be placed into.  The system
    98         *                  integrator must ensure that codecs within the same
    99         *                  group can not pre-empt each other.
   100         *
   101         *                  A common technique for assigning groupId's in
   102         *                  systems where same-priority tasks don't pre-empt
   103         *                  each other (e.g. DSP/BIOS) is to use the task priority.
   104         *                  Some systems do not allow sharing resources.  In
   105         *                  those systems, this parameter is ignored.
   106         *
   107         *                  Note that this parameter is ignored if "local" is not
   108         *                  TRUE.
   109         */
   110        struct AlgDesc {
   111            String          name;           /*! alg nick-name */
   112            ICodec.Module   mod;            /*! alg that implements skeletons */
   113            ThreadAttrs     threadAttrs;    /*! thread properties for each alg instance  */
   114            Int             groupId;        /*! group id of the algorithm */
   115        };
   116    
   117        /*!
   118         *  ======== threadAttrs ========
   119         *  Thread attributes for the Server daemon thread
   120         *
   121         *  A single Server thread is created within each DSP Server.  This thread
   122         *  accepts requests to create/destroy algorithm instances.
   123         *
   124         *  This thread is sometimes referred to as the Resource Manager Server
   125         *  (RMS) thread.
   126         *
   127         *  The `threadAttrs.stackSize` field is optional when configuring a
   128         *  server, though strongly recommended.  Stack overrun is a very common
   129         *  cause of system instability.  If the `threadAttrs.stackSize` field is
   130         *  not assigned by the server integrator's script, a default value of
   131         *  1K (1024 bytes) will be added to the value of
   132         *  {@link #stackSizePad stackSizePad} and used.
   133         *
   134         *  The `threadAttrs.priority` field is optional when configuring a
   135         *  server.  If it is not assigned, by the server integrator's script, a
   136         *  default value of {@link #MINPRI MINPRI} will be used.
   137         *
   138         *  The `threadAttrs.stackMemId` field is optional when configuring a
   139         *  server.  If it is not assigned, by the server integrator's script, a
   140         *  default value of 0 will be used.
   141         */
   142        config ThreadAttrs threadAttrs;
   143    
   144        /*!
   145         *  ======== algs ========
   146         *  Table of all algorithms supported by this DSP Server
   147         *
   148         *  See {@link #AlgDesc} documentation for more details.
   149         */
   150        config AlgDesc algs[];
   151    
   152      
   153        /*!
   154         *  ======== stackSizePad ========
   155         *  Pad applied to unconfigured, CE-created threads.
   156         *
   157         *  This pad is only applied to algorithm stacks that are not configured,
   158         *  as well as the {@link #threadAttrs Server thread} if it is not
   159         *  configured.
   160         */
   161        config Int stackSizePad = 8192;     
   162    
   163    
   164        /*!
   165         *  ======== traceBufferSize ========
   166         *  (DEPRECATED) Size of the server trace buffer, in MAUs.
   167         *
   168         *  Trace buffer size should be set via {@link
   169         *  ti.sdo.ce.osal.Global#traceBufferSize}.  Changing
   170         *  traceBufferSize here is currently supported for backward
   171         *  compatibility, but will not be supported in the future.
   172         *
   173         *  The server trace buffer is a circular buffer of characters written
   174         *  to by clients of the {@link ti.sdo.ce.osal} Trace interface -
   175         *  and read by the Engine_*Trace() methods.
   176         *
   177         * @_nodoc
   178         */
   179        config Int traceBufferSize = 0;
   180    
   181        /*!
   182         *  ======== autoGenScratchSizeArrays ========
   183         *  Enable automatic generation of {@link ti.sdo.fc.dskt2.DSKT2 DSKT2}
   184         *  scratch group size arrays.
   185         *
   186         *  This configuration flag enables/disables automatic generation of
   187         *  the {@link ti.sdo.fc.dskt2.DSKT2#DARAM_SCRATCH_SIZES} and
   188         *  {@link ti.sdo.fc.dskt2.DSKT2#SARAM_SCRATCH_SIZES} scratch group sizes
   189         *  arrays.
   190         *
   191         *  When enabled (1), the arrays will be automatically generated during
   192         *  Server configuration, based upon the
   193         *  {@link ICodec#getDaramScratchSize()} and
   194         *  {@link ICodec#getSaramScratchSize()} methods of the configured set of
   195         *  algorithms.
   196         *
   197         *  When disabled (0), the engine integrator needs to manually configure
   198         *  the scratch group sizes arrays.
   199         */
   200        config Bool autoGenScratchSizeArrays = 0;
   201    
   202        /*!
   203         *  ======== close ========
   204         *  internal close method (see package.xs)
   205         * @_nodoc
   206         */
   207        function close();
   208    
   209        /*!
   210         *  ======== validate ========
   211         *  internal validate method (see package.xs)
   212         * @_nodoc
   213         */
   214        function validate();
   215    }
   216    /*
   217     *  @(#) ti.sdo.ce; 1, 0, 6,308; 9-11-2008 13:22:12; /db/atree/library/trees/ce-i24x/src/
   218     */
   219