Dear Wendell<br><br><div class="gmail_quote">On Tue, Nov 23, 2010 at 12:18 PM, Wendell Pereira da Silva <span dir="ltr"><<a href="mailto:wendell.silva@compsisnet.com.br">wendell.silva@compsisnet.com.br</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">









<div link="blue" vlink="blue" lang="PT-BR">

<div>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Dear Jeferson,</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Well, let us try tty_driver
 :-)</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<p class="MsoNormal" style="margin-left: 18pt;"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Put #include <bsp/tty_drv.h> in your include list before #include
<rtems/confdefs.h></span></font></p>

<p class="MsoNormal" style="margin-left: 18pt;"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<p class="MsoNormal" style="margin-left: 18pt;"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Rigth after </span></font><span lang="EN-US">CONFIGURE_NUMBER_OF_TERMIOS_PORTS
</span><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">put the following:</span></font></p>

<p class="MsoNormal" style="margin-left: 54pt;"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">#define CONFIGURE_APPLICATION_EXTRA_DRIVERS \</span></font></p>


<p class="MsoNormal" style="margin-left: 54pt;"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">      TTY1_DRIVER_TABLE_ENTRY, \</span></font></p>

<p class="MsoNormal" style="margin-left: 54pt;"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">      TTY2_DRIVER_TABLE_ENTRY</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Let me know if it works.</span></font></p></div></div></blockquote><div><br><br>I cannot test it because in my compilation of RTEMS 4.9.4 (pc586 bsp) I do not see the header file <bsp/tty_driver.h>. I only see the following files:<br>
<br><bsp/bootcard.h><br><bsp/irq.h><br><bsp/irq_asm.h><br><br>I found in the list references to use this tty_driver but I cannot test because the file that support some definitions needed by the proposed solution do not exist in my compilation.<br>
<br>Best regards,<br>Jeferson.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div link="blue" vlink="blue" lang="PT-BR"><div>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Wendell.</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<p class="MsoNormal" style="margin-left: 54pt;"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">De:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> Jeferson Luiz
Rodrigues Souza [mailto:<a href="mailto:jeferodrigues@gmail.com" target="_blank">jeferodrigues@gmail.com</a>] <br>
<b><span style="font-weight: bold;">Enviada em:</span></b> terça-feira, 23 de
novembro de 2010 09:12<br>
<b><span style="font-weight: bold;">Para:</span></b> Wendell Pereira da Silva<br>
<b><span style="font-weight: bold;">Cc:</span></b> <a href="mailto:rtems-users@rtems.org" target="_blank">rtems-users@rtems.org</a><br>
<b><span style="font-weight: bold;">Assunto:</span></b> Re: Serial device access
with qemu!</span></font></p>

</div><div><div></div><div class="h5">

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Hi Wendell, <br>
<br>
thanks for your reply.</span></font></p>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">On Tue, Nov 23, 2010 at 11:04 AM, Wendell Pereira da Silva <<a href="mailto:wendell.silva@compsisnet.com.br" target="_blank">wendell.silva@compsisnet.com.br</a>>
wrote:</span></font></p>

<div link="blue" vlink="purple">

<div>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Hi Jeferson,</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Note that “/dev/ttyS0” in the QEMU is
not the same path registered by the pc586 (pc386 variant) BSP.</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Do you have tried “/dev/ttyS1”?</span></font></p>

</div>

</div>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
Yes, I tried with "/dev/ttyS1" and the same problem happens. I also
tested the serial port in the host and it is ok. <br>
<br>
Any idea?  <br>
<br>
Rest regards,<br>
Jeferson.</span></font></p>

</div>

<blockquote style="border-width: medium medium medium 1pt; border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204); padding: 0cm 0cm 0cm 6pt; margin-left: 4.8pt; margin-right: 0cm;">


<div link="blue" vlink="purple">

<div>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Best regards,</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Wendell.</span></font></p>

<p class="MsoNormal"><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">De:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:rtems-users-bounces@rtems.org" target="_blank">rtems-users-bounces@rtems.org</a> [mailto:<a href="mailto:rtems-users-bounces@rtems.org" target="_blank">rtems-users-bounces@rtems.org</a>]
<b><span style="font-weight: bold;">Em nome de </span></b>Jeferson Luiz Rodrigues
Souza<br>
<b><span style="font-weight: bold;">Enviada em:</span></b> terça-feira, 23 de
novembro de 2010 06:50<br>
<b><span style="font-weight: bold;">Para:</span></b> <a href="mailto:rtems-users@rtems.org" target="_blank">rtems-users@rtems.org</a><br>
<b><span style="font-weight: bold;">Assunto:</span></b> Serial device access with
qemu!</span></font></p>

</div>

<div>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Hi everyone,<br>
<br>
I am trying to access a serial port in RTEMS 4.9.4 using a pc586 bsp. However,
when I execute the application using qemu the code cannot open the device, and
the perror() function presents the following message: "No such file or
directory". It seems that RTEMS did not initialize a properly driver to
handle serial device. Is it right?<br>
<br>
The qemu command line is:<br>
<br>
sudo qemu -serial "/dev/ttyS0" -fda floppy.img -boot a<br>
<br>
I made a search in this list and I found references about serial port access
but nothing to help in my case. Could anyone help me or point me some
documentation about serial port access in RTEMS?<br>
<br>
The code used in the test is presented below. I do not have some experience
with RTEMS and I do not know the source of this problem.<br>
<br>
Thanks,<br>
jefecomp.<br>
<br>
<br>
</span></font><font size="2"><span style="font-size: 10pt;">#include
<signal.h><br>
#include <stdlib.h><br>
#include <stdio.h><br>
#include <pthread.h><br>
#include <uart.h><br>
#include <termios.h><br>
#include<sched.h><br>
#include <bsp.h><br>
#include <fcntl.h><br>
#include <sys/types.h><br>
#include <sys/stat.h><br>
<br>
#define CONFIGURE_INIT<br>
#include <rtems.h><br>
<br>
<br>
void *POSIX_Init();</span></font><br>
<br>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
#define CONFIGURE_APPLICATIONS_NEEDS_RTC_DRIVER<br>
#define CONFIGURE_MICROSECONDS_PER_TICK 1000<br>
<br>
#define CONFIGURE_MAXIMUM_POSIX_THREADS 10<br>
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 10<br>
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10<br>
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 10<br>
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 10<br>
#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 40<br>
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 10<br>
#define CONFIGURE_POSIX_INIT_THREAD_TABLE<br>
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5<br>
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 3<br>
#include<rtems/confdefs.h><br>
<br>
void *POSIX_Init()<br>
{<br>
    printf("Serial Port Test!!!\n");<br>
<br>
    char buffer[255];<br>
    int bytesRead;<br>
    int serial_fp = open("/dev/ttyS0",O_RDONLY);<br>
<br>
    printf("SERIAL_FP = %i\n",serial_fp);<br>
<br>
    if(serial_fp < 0)<br>
    {<br>
        printf("FAILURE TO OPEN SERIAL
PORT\n");<br>
        perror(serial_fp);<br>
        exit(-1);<br>
    }<br>
<br>
    //write(serial_fp,buffer,strlen(buffer)+1);<br>
    bytesRead = read(serial_fp, buffer, 255);<br>
    <br>
<br>
    if(bytesRead < 0)<br>
    {<br>
        printf("Problems in the read of
Serial Port");<br>
        close(serial_fp);<br>
        exit(1);<br>
    }<br>
    else<br>
        buffer[bytesRead] = 0;<br>
<br>
<br>
    printf(buffer);<br>
<br>
    close(serial_fp);<br>
    exit(0);<br>
}</p>

</div>

</div>

</div>

</div>

</blockquote>

</div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

</div></div></div>

</div>


</blockquote></div><br>