1    /* --COPYRIGHT--,ESD
     2     *  Copyright (c) 2008 Texas Instruments. All rights reserved. 
     3     *  This program and the accompanying materials are made available under the 
     4     *  terms of the Eclipse Public License v1.0 and Eclipse Distribution License
     5     *  v. 1.0 which accompanies this distribution. The Eclipse Public License is
     6     *  available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse
     7     *  Distribution License is available at 
     8     *  http://www.eclipse.org/org/documents/edl-v10.php.
     9     *
    10     *  Contributors:
    11     *      Texas Instruments - initial implementation
    12     * --/COPYRIGHT--*/
    13    /*
    14     *  ======== LoggerCallback.xdc ========
    15     */
    16    
    17    /*!
    18     *  ======== LoggerCallback ========
    19     *  A logger that passes events to a user supplied call back function
    20     *
    21     *  @a(Examples)
    22     *  Configuration example: The following XDC configuration statements
    23     *  create a logger instance, assign it as the default logger for all
    24     *  modules, and enable `USER1` logging in all modules of the package
    25     *  `my.pkg`. See the `{@link Diags#setMaskMeta Diags.setMaskMeta()}` function
    26     *  for details on specifying the module names.
    27     *
    28     *  @p(code)
    29     *  var Defaults = xdc.useModule('xdc.runtime.Defaults');
    30     *  var Diags = xdc.useModule('xdc.runtime.Diags');
    31     *  var LoggerCallback = xdc.useModule('xdc.runtime.LoggerCallback');
    32     *
    33     *  var LoggerCallbackParams = new LoggerCallback.Params();
    34     *  LoggerCallbackParams.callbackFxn = "&myCallbackFxn";
    35     *
    36     *  Defaults.common$.logger = LoggerCallback.create(LoggerCallbackParams);
    37     *  Diags.setMaskMeta("my.pkg.%", Diags.USER1, Diags.RUNTIME_ON);
    38     *  @p
    39     */
    40    
    41    module LoggerCallback inherits xdc.runtime.ILogger {
    42    
    43        /*!
    44         *  ======== ITimestampProxy ========
    45         *  User supplied time-stamp proxy
    46         *
    47         *  This proxy allows `LoggerCallback` to use a timestamp server different
    48         *  from the server used by `{@link xdc.runtime.Timestamp}`. However, if
    49         *  not supplied by a user, this proxy defaults to whichever timestamp
    50         *  server is used by `Timestamp`.
    51         */
    52        proxy TimestampProxy inherits xdc.runtime.ITimestampClient;
    53    
    54        /*!
    55         *  ======== CallbackFxn ========
    56         *  Callback character callback function
    57         *
    58         *  This function is called each time a Log event is generated by the 
    59         *  application.
    60         */
    61        typedef Void (*CallbackFxn)(xdc.runtime.Log.EventRec *);
    62    
    63        /*!
    64         *  ======== callbackFxn ========
    65         *  User suplied character callback function
    66         *
    67         *  If this parameter is set to a non-`null` value, the specified
    68         *  function will be called for each character received.
    69         *
    70         *  For example, if you define a function named `myCallbackFxn`, the
    71         *  following configuration fragment will cause `LoggerCallback` to call
    72         *  `myCallbackFxn` whenever a character is received.
    73         *  @p(code)
    74         *      var LoggerCallback = xdc.useModule("xdc.runtime.LoggerCallback");
    75         *      LoggerCallback.callbackFxn = "&myCallbackFxn";
    76         *  @p
    77         *
    78         *  If this parameter is not set, a default function will be used which
    79         *  simply drops the callback characters.
    80         *
    81         *  @see #CallbackFxn
    82         */
    83        config CallbackFxn callbackFxn = null;
    84    
    85    instance:
    86    
    87        /*!
    88         *  ======== create ========
    89         *  Create a `LoggerCallback` logger
    90         *     
    91         *  The logger instance will route all log events it receives to
    92         *  the {@link System#printf} function.
    93         */
    94        create();
    95     
    96    internal:
    97        
    98        struct Instance_State {
    99            Bool enabled;
   100        };
   101    }