1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
33
34 import xdc.runtime.ITimestampClient;
35 import xdc.runtime.IGateProvider;
36
37 38 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
77 @Gated
78
79 module LoggerSysTID inherits ti.sdo.utils.loggers.ILoggerMFP {
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
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
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 132 133
134