/*
    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
                 2011,2012,2013 Giovanni Di Sirio.

    This file is part of ChibiOS/RT.

    ChibiOS/RT is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    ChibiOS/RT is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/**
 * @file    tm.h
 * @brief   Time Measurement driver header.
 *
 * @addtogroup TM
 * @{
 */

#ifndef _TM_H_
#define _TM_H_

#if HAL_USE_TM || defined(__DOXYGEN__)

/*===========================================================================*/
/* Driver constants.                                                         */
/*===========================================================================*/

/*===========================================================================*/
/* Driver pre-compile time settings.                                         */
/*===========================================================================*/

/*===========================================================================*/
/* Derived constants and error checks.                                       */
/*===========================================================================*/

/*===========================================================================*/
/* Driver data structures and types.                                         */
/*===========================================================================*/

/**
 * @brief   Type of a Time Measurement object.
 * @note    Start/stop of measurements is performed through the function
 *          pointers in order to avoid inlining of those functions which
 *          could compromise measurement accuracy.
 * @note    The maximum measurable time period depends on the implementation
 *          of the realtime counter in the HAL driver.
 * @note    The measurement is not 100% cycle-accurate, it can be in excess
 *          of few cycles depending on the compiler and target architecture.
 * @note    Interrupts can affect measurement if the measurement is performed
 *          with interrupts enabled.
 */
typedef struct TimeMeasurement TimeMeasurement;

/**
 * @brief   Time Measurement structure.
 */
struct TimeMeasurement {
  void (*start)(TimeMeasurement *tmp);  /**< @brief Starts a measurement.   */
  void (*stop)(TimeMeasurement *tmp);   /**< @brief Stops a measurement.    */
  halrtcnt_t           last;            /**< @brief Last measurement.       */
  halrtcnt_t           worst;           /**< @brief Worst measurement.      */
  halrtcnt_t           best;            /**< @brief Best measurement.       */
};

/*===========================================================================*/
/* Driver macros.                                                            */
/*===========================================================================*/

/**
 * @brief   Starts a measurement.
 * @pre     The @p TimeMeasurement must be initialized.
 * @note    This function can be invoked in any context.
 *
 * @param[in,out] tmp   pointer to a @p TimeMeasurement structure
 *
 * @special
 */
#define tmStartMeasurement(tmp) (tmp)->start(tmp)

/**
 * @brief   Stops a measurement.
 * @pre     The @p TimeMeasurement must be initialized.
 * @note    This function can be invoked in any context.
 *
 * @param[in,out] tmp   pointer to a @p TimeMeasurement structure
 *
 * @special
 */
#define tmStopMeasurement(tmp) (tmp)->stop(tmp)

/*===========================================================================*/
/* External declarations.                                                    */
/*===========================================================================*/

#ifdef __cplusplus
extern "C" {
#endif
  void tmInit(void);
  void tmObjectInit(TimeMeasurement *tmp);
#ifdef __cplusplus
}
#endif

#endif /* HAL_USE_TM */

#endif /* _TM_H_ */

/** @} */
' href='#n25'>25</a>
<a id='n26' href='#n26'>26</a>
<a id='n27' href='#n27'>27</a>
<a id='n28' href='#n28'>28</a>
<a id='n29' href='#n29'>29</a>
<a id='n30' href='#n30'>30</a>
<a id='n31' href='#n31'>31</a>
<a id='n32' href='#n32'>32</a>
<a id='n33' href='#n33'>33</a>
<a id='n34' href='#n34'>34</a>
<a id='n35' href='#n35'>35</a>
<a id='n36' href='#n36'>36</a>
<a id='n37' href='#n37'>37</a>
<a id='n38' href='#n38'>38</a>
<a id='n39' href='#n39'>39</a>
<a id='n40' href='#n40'>40</a>
<a id='n41' href='#n41'>41</a>
<a id='n42' href='#n42'>42</a>
<a id='n43' href='#n43'>43</a>
<a id='n44' href='#n44'>44</a>
<a id='n45' href='#n45'>45</a>
<a id='n46' href='#n46'>46</a>
<a id='n47' href='#n47'>47</a>
<a id='n48' href='#n48'>48</a>
<a id='n49' href='#n49'>49</a>
<a id='n50' href='#n50'>50</a>
<a id='n51' href='#n51'>51</a>
<a id='n52' href='#n52'>52</a>
<a id='n53' href='#n53'>53</a>
</pre></td>
<td class='lines'><pre><code><style>pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="k">\subsection</span><span class="nb">{</span>How to contribute<span class="nb">}</span>
OpenWrt is constantly being improved.  We&#39;d like as many people to contribute
to this as we can get. If you find a change useful, by all means try to get
it incorporated into the project. This should improve OpenWrt and it should
help carry your changes forward into future versions

This section tries to lay out a procedure to enable people to submit patches
in a way that is most effective for all concerned.

It is important to do all these steps repeatedly:

<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
	<span class="k">\item</span> <span class="k">\textit</span><span class="nb">{</span>listen<span class="nb">}</span> to what other people think.
	<span class="k">\item</span> <span class="k">\textit</span><span class="nb">{</span>talk<span class="nb">}</span> explaining what problem you are addressing and your
		proposed solution.
	<span class="k">\item</span> <span class="k">\textit</span><span class="nb">{</span>do<span class="nb">}</span> write useful patches including documentation.
    <span class="k">\item</span> <span class="k">\textit</span><span class="nb">{</span>test. test. test.<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>

<span class="k">\subsection</span><span class="nb">{</span>Where to listen and talk<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
	<span class="k">\item</span> google to find things related to your problem
	<span class="k">\item</span> Mailing lists: <span class="k">\href</span><span class="nb">{</span>http://lists.openwrt.org/<span class="nb">}{</span>http://lists.openwrt.org/<span class="nb">}</span>
	<span class="k">\item</span> Wiki: check the wiki: <span class="k">\href</span><span class="nb">{</span>http://wiki.openwrt.org/OpenWrtDocs<span class="nb">}{</span>http://wiki.openwrt.org/OpenWrtDocs<span class="nb">}</span>
	<span class="k">\item</span> Forum: <span class="k">\href</span><span class="nb">{</span>http://forum.openwrt.org/<span class="nb">}{</span>http://forum.openwrt.org/<span class="nb">}</span>
	<span class="k">\item</span> IRC: <span class="k">\texttt</span><span class="nb">{</span>irc.freenode.net<span class="nb">}</span>, channels <span class="k">\texttt</span><span class="nb">{</span><span class="k">\#</span>openwrt<span class="nb">}</span> and 
		<span class="k">\texttt</span><span class="nb">{</span><span class="k">\#</span>openwrt-devel<span class="nb">}</span>
	<span class="k">\item</span> TRAC: <span class="k">\href</span><span class="nb">{</span>https://dev.openwrt.org/<span class="nb">}{</span>https://dev.openwrt.org/<span class="nb">}</span> the issue/bug/change tracking system
<span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>

It is often best to document what you are doing before you do it.  The process
of documentation often exposes possible improvements.  Keep your documentation
up to date.

<span class="k">\subsection</span><span class="nb">{</span>Patch Submission Process<span class="nb">}</span>
<span class="k">\begin</span><span class="nb">{</span>enumerate<span class="nb">}</span>
	<span class="k">\item</span> Use git or svn to create a patch. Creating patches manually with 
		<span class="k">\textit</span><span class="nb">{</span>diff -urN<span class="nb">}</span> also works, but is usually unnecessary.
	<span class="k">\item</span> Send a mail to openwrt-devel@lists.openwrt.org with the following contents:
	<span class="k">\begin</span><span class="nb">{</span>enumerate<span class="nb">}</span>
		<span class="k">\item</span> <span class="k">\texttt</span><span class="nb">{</span>[PATCH] &lt;short description&gt;<span class="nb">}</span> in the Subject, followed by:
		<span class="k">\item</span> (optional) a longer description of your patch in the message body
        <span class="k">\item</span> <span class="k">\texttt</span><span class="nb">{</span>Signed-off-by: Your name &lt;your@email.address&gt;<span class="nb">}</span>
		<span class="k">\item</span> Your actual patch, inline, not word wrapped or whitespace mangled. 
	<span class="k">\end</span><span class="nb">{</span>enumerate<span class="nb">}</span>
	<span class="k">\item</span> Please read <span class="k">\href</span><span class="nb">{</span>http://kerneltrap.org/Linux/Email<span class="k">\_</span>Clients<span class="k">\_</span>and<span class="k">\_</span>Patches<span class="nb">}{</span>http://kerneltrap.org/Linux/Email<span class="k">\_</span>Clients<span class="k">\_</span>and<span class="k">\_</span>Patches<span class="nb">}</span>
		to find out how to make sure your email client doesn&#39;t destroy your patch.
	<span class="k">\item</span> Please use your real name and email address in the <span class="k">\texttt</span><span class="nb">{</span>Signed-off-by<span class="nb">}</span>
		line, following the same guidelines as in the <span class="k">\href</span><span class="nb">{</span>http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/SubmittingPatches;h=681e2b36195c98ea5271b76383b3a574b190b04f;hb=HEAD<span class="nb">}{</span>Linux Kernel patch submission guidelines<span class="nb">}</span>
	<span class="k">\item</span> Example of a properly formatted patch submission: <span class="k">\\</span>
	<span class="k">\href</span><span class="nb">{</span>http://lists.openwrt.org/pipermail/openwrt-devel/2007-November/001334.html<span class="nb">}{</span>http://lists.openwrt.org/pipermail/openwrt-devel/2007-November/001334.html<span class="nb">}</span>
<span class="k">\end</span><span class="nb">{</span>enumerate<span class="nb">}</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.25.1</a>) at 2025-03-30 20:38:53 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
