[BACK]Return to sample.html CVS log [TXT][DIR] Up to [local] / prex-old / doc / html / doc

Annotation of prex-old/doc/html/doc/sample.html, Revision 1.1

1.1     ! nbrk        1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
        !             2: <html>
        !             3: <head>
        !             4:   <title>Prex Sample Codes</title>
        !             5:   <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
        !             6:   <meta name="keywords" content="Prex, embedded, real-time, operating system, RTOS, open source, free">
        !             7:   <meta name="author" content="Kohsuke Ohtani">
        !             8:   <link rel="stylesheet" type="text/css" href="../default.css" media="screen">
        !             9:   <link rel="stylesheet" type="text/css" href="../print.css" media="print">
        !            10: </head>
        !            11: <body>
        !            12: <div id="top">
        !            13: </div>
        !            14: <div id="middle">
        !            15: 
        !            16: <table id="content" cellpadding="0" cellspacing="0">
        !            17:   <tbody>
        !            18: 
        !            19:     <tr>
        !            20:       <td id="header" colspan="2" valign="top">
        !            21:         <table width="100%" border="0" cellspacing="0" cellpadding="0">
        !            22:         <tr>
        !            23:           <td id="logo">
        !            24:             <a href="http://prex.sourceforge.net/">
        !            25:             <img alt="Prex logo" src="../img/logo.gif" border="0"
        !            26:             style="width: 281px; height: 56px;"></a>
        !            27:           </td>
        !            28:           <td id="brief" align="right" valign="bottom">
        !            29:             An Open Source, Royalty-free,<br>
        !            30:            Real-time Operating System
        !            31:           </td>
        !            32:         </tr>
        !            33:         </table>
        !            34:       </td>
        !            35:     </tr>
        !            36: 
        !            37:     <tr>
        !            38:       <td id="directory" style="vertical-align: top;">
        !            39:       <a href="http://prex.sourceforge.net/">Prex Home</a> >
        !            40:       <a href="index.html">Document Index</a> >
        !            41:       Sample Codes
        !            42:     </tr>
        !            43:     <tr><td class="pad" colspan="2" style="vertical-align: top;"></td></tr>
        !            44: 
        !            45:     <tr>
        !            46:       <td id="main" style="vertical-align: top;">
        !            47:       <h1>Sample Codes</h1>
        !            48: 
        !            49: <i>Version 1.0, 2005/09/01</i>
        !            50: 
        !            51: <h3>Table of Contents</h3>
        !            52: <ul>
        !            53:   <li><a href="#run">Running a new thread</a></li>
        !            54:   <li><a href="#ptmr">Periodic timer</a></li>
        !            55: </ul>
        !            56: <br>
        !            57: 
        !            58: <h2 id="run">Running a new thread</h2>
        !            59: <p>
        !            60: This is a sample to create and run a new thread in the same task.
        !            61: </p>
        !            62: <pre>
        !            63: int thread_run(void *start, void *stack, thread_t *th)
        !            64: {
        !            65:         thread_t t;
        !            66:         int err;
        !            67: 
        !            68:         err = thread_create(task_self(), &amp;t);
        !            69:         if (err)
        !            70:                  return err;
        !            71: 
        !            72:         err = thread_load(t, start, stack);
        !            73:         if (err)
        !            74:                  return err;
        !            75: 
        !            76:         err = thread_resume(t);
        !            77:         if (err)
        !            78:                  return err;
        !            79: 
        !            80:         *th = t;
        !            81:         return 0;
        !            82: }
        !            83: </pre>
        !            84: 
        !            85: 
        !            86: <h2 id="ptmr">Periodic timer</h2>
        !            87: <p>
        !            88: This is a sample to show a message per 100msec starting after 5sec.
        !            89: </p>
        !            90: <pre>
        !            91: int main()
        !            92: {
        !            93:         int count = 0;
        !            94: 
        !            95:         sys_log("periodic timer test program\n");
        !            96: 
        !            97:         /* Setup timer */
        !            98:         timer_periodic(thread_self(), 5000, 100);
        !            99: 
        !           100:         while (count++ < 5) {
        !           101:                 timer_waitperiod();
        !           102:                 sys_log("Hello!\n");
        !           103:         }
        !           104: 
        !           105:         /* Cancel timer */
        !           106:         timer_periodic(thread_self(), 0, 0);
        !           107:         return 0;
        !           108: }
        !           109: </pre>
        !           110: 
        !           111:       </td>
        !           112:     </tr>
        !           113:     <tr>
        !           114:       <td id="footer" colspan="2" style="vertical-align: top;">
        !           115:         <a href="http://sourceforge.net">
        !           116:         <img src="http://sourceforge.net/sflogo.php?group_id=132028&amp;type=1"
        !           117:         alt="SourceForge.net Logo" border="0" height="31" width="88"></a><br>
        !           118:         Copyright&copy; 2005-2007 Kohsuke Ohtani
        !           119:       </td>
        !           120:     </tr>
        !           121: 
        !           122:   </tbody>
        !           123: </table>
        !           124: 
        !           125: </div>
        !           126: <div id="bottom"></div>
        !           127: 
        !           128: </body>
        !           129: </html>

CVSweb