1    /* 
     2     * Copyright (c) 2011, 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    import xdc.runtime.ITimestampClient;
    35    import xdc.runtime.IGateProvider;
    36    
    37    /*
    38     *  ======== LoggerSysTID.xdc ========
    39     *
    40     */
    41    
    42    /*!
    43     *  ======== LoggerSysTID ========
    44     *  A logger which routes events to the system `printf` function.
    45     *
    46     *  This logger processes log events as they are generated and routes
    47     *  them through the `{@link System#printf System_printf()}` function.
    48     *  The final disposition of the log event is dependent on which system
    49     *  provider has been assigned to the
    50     *  `{@link System#SupportProxy System.SupportProxy}` configuration parameter.
    51     *
    52     *  Note that the log events are processed within the runtime context
    53     *  of the `{@link Log Log_write()}` or `{@link Log Log_print()}` function
    54     *  that generated the event. It is important to account for the processing
    55     *  overhead and stack usage imposed on the runtime context. The cost of
    56     *  this processing is defined by the implementation of the system provider.
    57     *
    58     *  @a(Examples)
    59     *  Configuration example: The following XDC configuration statements
    60     *  create a logger instance, assign it as the default logger for all
    61     *  modules, and enable `USER1` logging in all modules of the package
    62     *  `my.pkg`. See the `{@link Diags#setMaskMeta Diags.setMaskMeta()}` function
    63     *  for details on specifying the module names.
    64     *
    65     *  @p(code)
    66     *  var Defaults = xdc.useModule('xdc.runtime.Defaults');
    67     *  var Diags = xdc.useModule('xdc.runtime.Diags');
    68     *  var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
    69     *
    70     *  var LoggerSysParams = new LoggerSys.Params();
    71     *  Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
    72     *  Diags.setMaskMeta("my.pkg.%", Diags.USER1, Diags.RUNTIME_ON);
    73     *  @p
    74     */
    75    
    76    @ModuleStartup      /* Initialize module */
    77    @Gated
    78    
    79    module LoggerSysTID inherits ti.sdo.utils.loggers.ILoggerMFP { // xdc.runtime.ILogger {
    80    
    81        /*! Timestamp display format */
    82        enum TSMode {
    83            TSMode_USEC,        /*! Timestamps displayed in microseconds */
    84            TSMode_SEC,         /*! Timestamps displayed in seconds */
    85            TSMode_DELTAUSEC,   /*! Timestamp differences in microseconds */
    86            TSMode_TICKS        /*! Timestamps displayed in timer counter ticks */
    87        };
    88    
    89        /*!
    90         *  ======== control ========
    91         *  A hook for sending commands to the logger. For example, this can
    92         *  be used to re-configure the timestamp display format.
    93         *
    94         *  @param(cmd)         control command
    95         *  @param(cmdArgs)     command argument
    96         */
    97    //    Void control(Int cmd, UArg cmdArgs);
    98    
    99        /*!
   100         *  ======== ITimestampProxy ========
   101         *  User supplied time-stamp proxy
   102         *
   103         *  This proxy allows `LoggerSys` to use a timestamp server different
   104         *  from the server used by `{@link xdc.runtime.Timestamp}`. However, if
   105         *  not supplied by a user, this proxy defaults to whichever timestamp
   106         *  server is used by `Timestamp`.
   107         */
   108        proxy TimestampProxy inherits ITimestampClient;
   109    
   110        // Get a handle to the module's gate.
   111        config IGateProvider.Handle gate;
   112    
   113    instance:
   114    
   115        /*!
   116         *  ======== create ========
   117         *  Create a `LoggerSys` logger
   118         *
   119         *  The logger instance will route all log events it receives to
   120         *  the {@link System#printf} function.
   121         */
   122        create();
   123    
   124    internal:
   125        
   126        struct Instance_State {
   127            Bool enabled;
   128        };
   129    }
   130    /*
   131     *  @(#) ti.sdo.utils.loggers; 1, 0, 0,1; 12-9-2011 16:49:55; /db/atree/library/trees/osal/osal-e06/src/ xlibrary
   132    
   133     */
   134