trouble with application programe of serial port (use bsp of pc386)

Joel Sherrill joel.sherrill at OARcorp.com
Thu Feb 16 15:53:49 UTC 2012


On 02/16/2012 09:43 AM, zhoupeng wrote:
> Excuse me.
> I will add a brief postscript to my question ,can i use
> rtems_io_open() ...directly?
> I think ,in this situation , we may use arguments just i give.
Please just use the POSIX calls. :)
> Thanks.
>
>
> At 2012-02-16 21:37:51,"Joel Sherrill" <joel.sherrill at oarcorp.com> wrote:
>
>     The short answer is that you shouldn't be programming it at this
>     level.
>     You should be doing something like this:
>
>     int fd;
>
>     fd = open( "/dev/xxx", ...);
>     write( fd, buffer, length );
>
>     It doesn't matter to you what the interface between the driver and
>     termios framework is. You should be using POSIX calls like open, read,
>     write, and ioctl. The Termios API is used for changing things like
>     baud
>     rate, bits per character, etc.
>
>     I don't know how good this is but a google turned up this which
>     doesn't
>     look too bad at first glance as an introduction to termios
>     capabilities:
>
>     http://en.wikibooks.org/wiki/Serial_Programming/termios
>
>     --joel
>
>     On 02/16/2012 07:29 AM, zhoupeng wrote:
>>
>>     Hello guys,
>>
>>     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.
>>
>>     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.
>>
>>     rtems_device_driver
>>     tty_read(rtems_device_major_number major,
>>     rtems_device_minor_number minor,
>>     void *arg)
>>     {
>>     return rtems_termios_read (arg);
>>     } /* tty_read */
>>
>>     rtems_status_code
>>     rtems_termios_read (void *arg)
>>     {
>>     rtems_libio_rw_args_t *args = arg;
>>     struct rtems_termios_tty *tty = args->iop->data1;
>>     uint32_t count = args->count;
>>     char *buffer = args->buffer;
>>     rtems_status_code sc;
>>
>>     ...}
>>
>>     we can find a important arguements *arg , it's a pointer point to
>>     a struct .This struct have three member ,they are
>>
>>     args->iop->data1 \ args->count \ args->buffer
>>
>>     who know their funcations??? I believe in application programe
>>     ,we have to provide these arguements!
>>
>>     Can you provide a test programe of serial port with this drive in
>>     bsp of pc386.?
>>
>>     Thanks so much!
>>
>>     Best wish!
>>
>>     zhoupeng
>>
>>
>>
>
>
>     -- 
>     Joel Sherrill, Ph.D.             Director of Research&  Development
>     joel.sherrill at OARcorp.com        On-Line Applications Research
>     Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>         Support Available             (256) 722-9985
>
>
>
>


-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20120216/38958538/attachment.html>


More information about the users mailing list