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><font style="font-family: times new roman,serif;" size="2">#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();</font><br><br><span style="font-family: times new roman,serif;">#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">#define CONFIGURE_APPLICATIONS_NEEDS_RTC_DRIVER</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">#define CONFIGURE_MICROSECONDS_PER_TICK 1000</span><br style="font-family: times new roman,serif;"><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">#define CONFIGURE_MAXIMUM_POSIX_THREADS 10</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 10</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 10</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">#define CONFIGURE_MAXIMUM_POSIX_TIMERS 10</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 40</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 10</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">#define CONFIGURE_POSIX_INIT_THREAD_TABLE</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 3</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">#include<rtems/confdefs.h></span><br style="font-family: times new roman,serif;">
<br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">void *POSIX_Init()</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">{</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    printf("Serial Port Test!!!\n");</span><br style="font-family: times new roman,serif;"><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    char buffer[255];</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    int bytesRead;</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    int serial_fp = open("/dev/ttyS0",O_RDONLY);</span><br style="font-family: times new roman,serif;">
<br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    printf("SERIAL_FP = %i\n",serial_fp);</span><br style="font-family: times new roman,serif;"><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    if(serial_fp < 0)</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    {</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">        printf("FAILURE TO OPEN SERIAL PORT\n");</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">        perror(serial_fp);</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">        exit(-1);</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    }</span><br style="font-family: times new roman,serif;">
<br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    //write(serial_fp,buffer,strlen(buffer)+1);</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    bytesRead = read(serial_fp, buffer, 255);</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    </span><br style="font-family: times new roman,serif;"><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    if(bytesRead < 0)</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    {</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">        printf("Problems in the read of Serial Port");</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">        close(serial_fp);</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">        exit(1);</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    }</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    else</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">        buffer[bytesRead] = 0;</span><br style="font-family: times new roman,serif;"><br style="font-family: times new roman,serif;"><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    printf(buffer);</span><br style="font-family: times new roman,serif;"><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">    close(serial_fp);</span><br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">    exit(0);</span><br style="font-family: times new roman,serif;"><span style="font-family: times new roman,serif;">}</span><br>