<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=GB2312" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    On 02/16/2012 09:43 AM, zhoupeng wrote:
    <blockquote
      cite="mid:18331ab7.277c7.13586d5948f.Coremail.zpeng563@126.com"
      type="cite">
      <div style="line-height: 1.7; color: rgb(0, 0, 0); font-size:
        14px; font-family: arial;">
        <div>Excuse me.</div>
        <div>I will add a brief postscript to my question ,can i use <span
            style="color: rgb(255, 0, 0);">rtems_io_open() </span>...directly?</div>
        <div>I think ,in this situation , we may use arguments  just i
          give.</div>
      </div>
    </blockquote>
    Please just use the POSIX calls. :)<br>
    <blockquote
      cite="mid:18331ab7.277c7.13586d5948f.Coremail.zpeng563@126.com"
      type="cite">
      <div style="line-height: 1.7; color: rgb(0, 0, 0); font-size:
        14px; font-family: arial;">
        <div>Thanks.<br>
          <br>
        </div>
        <div><br>
        </div>
        At 2012-02-16
        21:37:51,"Joel Sherrill" <a class="moz-txt-link-rfc2396E" href="mailto:joel.sherrill@oarcorp.com"><joel.sherrill@oarcorp.com></a>
        wrote:<br>
        <blockquote id="isReplyContent" style="padding-left: 1ex;
          margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204,
          204, 204);">The short answer is that you shouldn't be
          programming it at this level.<br>
          You should be doing something like this:<br>
          <br>
          int fd;<br>
          <br>
          fd = open( "/dev/xxx", ...);<br>
          write( fd, buffer, length );<br>
          <br>
          It doesn't matter to you what the interface between the driver
          and<br>
          termios framework is. You should be using POSIX calls like
          open, read,<br>
          write, and ioctl. The Termios API is used for changing things
          like baud<br>
          rate, bits per character, etc.<br>
          <br>
          I don't know how good this is but a google turned up this
          which doesn't<br>
          look too bad at first glance as an introduction to termios
          capabilities:<br>
          <br>
          <a moz-do-not-send="true"
            href="http://en.wikibooks.org/wiki/Serial_Programming/termios">http://en.wikibooks.org/wiki/Serial_Programming/termios</a><br>
          <br>
          --joel<br>
          <br>
          On 02/16/2012 07:29 AM, zhoupeng wrote:
          <blockquote
            cite="mid:5e5be79.26233.135865a4571.Coremail.zpeng563@126.com"
            type="cite">
            <div style="font-size: 14px; color: rgb(0, 0, 0);
              line-height: 1.7; font-family: arial;">
              <div>
                <p class="MsoNormal">Hello guys,</p>
                <p class="MsoNormal"><o:p>I am a student. Now i have
                    take part in a project which is based on x86 cpu.
                    So i study BSP of PC386. Precently,i want to write a
                    application program of serial port. Because,the BSP
                    of PC386 is provide the serial port driver. So we
                    can use the serial port driver directly.</o:p></p>
                <p class="MsoNormal"><o:p>The soruce code of this drive
                    programe include tty_drv.c\ termios.c\ uart.c...
                    Before i write the application programe , i made a
                    analysis about this driver. Let's look some code
                    whic is come out of these files.</o:p></p>
                <p class="MsoNormal"><o:p></o:p></p>
                <span style="color: rgb(0, 0, 255);">
                  <p class="MsoNormal"><o:p>rtems_device_driver<br>
                      tty_read(rtems_device_major_number major,<br>
                                   rtems_device_minor_number minor,<br>
                                   void                      *arg)<br>
                      {<br>
                        return rtems_termios_read (arg);<br>
                      } /* tty_read */</o:p></p>
                  <p class="MsoNormal"><o:p>rtems_status_code<br>
                      rtems_termios_read (void *arg)<br>
                      {<br>
                       rtems_libio_rw_args_t *args = arg;<br>
                       struct rtems_termios_tty *tty =
                      args->iop->data1;<br>
                       uint32_t   count = args->count;<br>
                       char      *buffer = args->buffer;<br>
                       rtems_status_code sc;</o:p><o:p> </o:p></p>
                  <p class="MsoNormal"><o:p>...</o:p><o:p>}</o:p></p>
                </span>
                <p class="MsoNormal"><o:p><span style="color: rgb(0, 0,
                      255);"></span>we can find a important arguements <span
                      style="font-size: 32px; color: rgb(255, 0, 0);">*arg
                    </span>, <span style="color: rgb(255, 0, 0);">it's
                      a pointer point to a struct .This struct have
                      three member</span> ,they are </o:p></p>
                <p class="MsoNormal"><o:p>args->iop->data1 \
                    args->count \ args->buffer </o:p></p>
                <p class="MsoNormal"><o:p><span style="font-size: 24px;"></span><span
                      style="font-size: 24px;"><span style="color:
                        rgb(255, 0, 0);"></span><span style="color:
                        rgb(0, 0, 0);">who know their funcations??? I
                        believe in application programe ,we have to
                        provide these arguements!</span></span></o:p></p>
                <p class="MsoNormal"><o:p><span style="font-size: 24px;
                      color: rgb(0, 0, 0);"></span><span
                      style="font-size: 24px;"></span><span
                      style="color: rgb(0, 255, 0);"><span
                        style="font-size: 24px;"></span></span><span
                      style="color: rgb(255, 0, 0);"><span
                        style="font-size: 24px;">Can you provide a test
                        programe of serial port with this drive in bsp
                        of pc386.? </span></span></o:p></p>
                <p class="MsoNormal"><o:p style="font-size: 24px; color:
                    rgb(255, 0, 0);"></o:p><o:p><span style="font-size:
                      24px; color: rgb(255, 0, 0);"></span>Thanks so
                    much!<o:p></o:p></o:p></p>
                <p class="MsoNormal">Best wish!</p>
                <p class="MsoNormal">zhoupeng</p>
              </div>
            </div>
            <br>
            <br>
            <span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote>
          <br>
          <br>
          <pre class="moz-signature" cols="72">-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:joel.sherrill@OARcorp.com">joel.sherrill@OARcorp.com</a>        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

</pre>
        </blockquote>
      </div>
      <br>
      <br>
      <span title="neteasefooter"><span id="netease_mail_footer"></span></span>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
<a class="moz-txt-link-abbreviated" href="mailto:joel.sherrill@OARcorp.com">joel.sherrill@OARcorp.com</a>        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

</pre>
  </body>
</html>