RAW UART

Wendell Silva silvawp at gmail.com
Mon Dec 23 18:40:07 UTC 2013


What BSP are we taking about?
I've used the configuration bellow to get a "raw mode" in my customized
pc386 BSP:
Well, the right way... The code bellow has proved good enough to my needs.
I guess the only way to avoid this is to implement your own driver (based
on UART driver) and not register it a termios pseudo-driver for it, but you
will need to consider ring-buffers, multi-task access, etc.

Does someone have can add comments?


---BEGIN--- [ the control flow (if... else...) was removed for sake of
simplicity) ]-----

#include <fcntl.h>
#include <termios.h>
#include <unistd.h>

struct termios opt;
int fd = open("/dev/serial0", O_RDWR | O_NOCTTY);
tcgetattr(fd, &opt)
cfsetispeed(&opt, B115200);
cfsetospeed(&opt, B115200);

/*
 * Set options for raw-mode (binary) data transfer over serial
 */
opt.c_iflag &= ~(IGNBRK | BRKINT | PARMRK |
                 ISTRIP | INLCR  | IGNCR  |
                 ICRNL  | IXON);
opt.c_oflag &= ~OPOST;
opt.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
opt.c_cflag &= ~(CSIZE | PARENB);
opt.c_cflag |= CS8;

tcsetattr(fd, TCSANOW, &opt);

---END---




2013/12/23 Nicolás Alvarez <nicoalar.22 at gmail.com>

> Hi all,
>
> I'm trying to use the raw uart driver interface, but it looks like that
> the bsp is initializing the console driver. How can I avoid this? I have
> read that someone use the console driver in "raw mode", is it the right way?
>
> Regards,
>
> *Ing. Nicolás Alvarez*
>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20131223/509b6720/attachment-0001.html>


More information about the users mailing list