<!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">
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 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="line-height: 1.7; color: rgb(0, 0, 0); font-size:
14px; 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 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>