RTEMS on QEMU with virtual serial device
Мороз Олег
oleg.moroz at mcc.vniiem.ru
Wed Oct 1 12:35:16 UTC 2014
I've solved my problem using code changes
diff --git a/c/src/lib/libbsp/i386/shared/comm/uart.c
b/c/src/lib/libbsp/i386/shared/comm/uart.c
index 3c4d42a..3552fe6 100644
--- a/c/src/lib/libbsp/i386/shared/comm/uart.c
+++ b/c/src/lib/libbsp/i386/shared/comm/uart.c
@@ -568,12 +568,13 @@ BSP_uart_termios_read_com2(int uart)
ssize_t
BSP_uart_termios_write_com1(int minor, const char *buf, size_t len)
{
+ if(len <= 0)
+ {
+ return 0;
+ }
assert(buf != NULL);
- if(len <= 0)
- {
- return 0;
- }
+
/* If there TX buffer is busy - something is royally screwed up */
assert((uread(BSP_UART_COM1, LSR) & THRE) != 0);
@@ -602,13 +603,13 @@ BSP_uart_termios_write_com1(int minor, const char
*buf, size_t len)
ssize_t
BSP_uart_termios_write_com2(int minor, const char *buf, size_t len)
{
- assert(buf != NULL);
+
if(len <= 0)
{
return 0;
}
-
+ assert(buf != NULL);
/* If there TX buffer is busy - something is royally screwed up */
assert((uread(BSP_UART_COM2, LSR) & THRE) != 0);
Is it alright?
On 28.09.2014 19:19, Wendell Silva wrote:
> Have you tried:
> qemu-system-i386 -serial file:/tmp/1.txt -serial file:/tmp/2.txt
> -kernel ...
>
> Or open ttyS1 instead?
>
> --Wendell.
>
>
> 2014-09-28 4:52 GMT-03:00 Олег Мороз <oleg.moroz at mcc.vniiem.ru
> <mailto:oleg.moroz at mcc.vniiem.ru>>:
>
> Hello everyone, i'm trying to develop RTEMS app using QEMU VM. How
> can i use virtual serial device for two side data exchange between
> VM and host machine. I'm trying to use it in that way:
>
>
>
> #include <bsp.h> /* for device driver prototypes */
>
> #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
> #define CONFIGURE_APPLICATION_EXTRA_DRIVERS TTY2_DRIVER_TABLE_ENTRY
> #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
> #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
> #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 6
>
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> .....
>
>
> then in my app i'm trying to open /dev/ttyS2 device
>
> unsigned char data[4] = {1,2,3,4};
> int f =open("/dev/ttyS2", O_RDWR | O_NOCTTY | _FNDELAY);
> if (f>0)
> {
> printf("write data %d\n",write(f,data,4));
> }
>
> then start QEMU
> qemu-system-i386 -serial file:/tmp/1.txt -kernel zvezda_shell.exe
>
>
> In QEMU shell i've seen
> Device: /dev/ttyS2 initialized.
> write data 4
>
> But in fact file /tmp/1.txt has no data. How can i solve it and
> use QEMU -serial for both side data exchange?
> _______________________________________________
> devel mailing list
> devel at rtems.org <mailto:devel at rtems.org>
> http://lists.rtems.org/mailman/listinfo/devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20141001/b043062a/attachment.html>
More information about the devel
mailing list