All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Jackel <ich@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] Re: read data from serial device
Date: Thu, 23 Mar 2006 13:41:03 +0100	[thread overview]
Message-ID: <dvu50v$5pq$1@domain.hid> (raw)
In-Reply-To: <dvrrgc$g2a$1@domain.hid>

Hi

Another try....

Marco Jackel wrote:
> I want to read data from the serial device

to read data from a serial device I do the following:

/* config for serial device */

static const struct rtser_config ser_config = {
    0xFFFF,                     /* config_mask */
    RTSER_DEF_BAUD,          /* baud_rate */
    RTSER_ODD_PARITY ,           /* parity */
    RTSER_8_BITS ,             /* data_bits */
    RTSER_1_STOPB ,            /* stop_bits */
    RTSER_NO_HAND ,             /* handshake */
    RTSER_DEF_FIFO_DEPTH,       /* fifo_depth*/
    RTSER_DEF_TIMEOUT,          /* rx_timeout */
    RTSER_DEF_TIMEOUT,          /* tx_timeout */
    RTSER_DEF_TIMEOUT,          /* event_timeout */
    RTSER_RX_TIMESTAMP_HISTORY, /* timestamp_history */
    RTSER_EVENT_RXPEND          /* event mask */
};

/* open the serial file */

my_fd = rt_dev_open( RTSER_FILE, 0);

/* write the serial config */

ret = rt_dev_ioctl(my_fd, RTSER_RTIOC_SET_CONFIG, &ser_config);

/* read from the device */

unsigned char buf[32];
int sz;
int red = 0;
struct rtser_event rx_event;

while (1) {
  ret = rt_task_set_mode(0, T_PRIMARY, NULL);
  ret = rt_dev_ioctl(my_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event );
  red = rt_dev_read(my_fd, &buf, sizeof(buf));
  printf(RTASK_PREFIX "rt_dev_read=%s\n",buf);
  printf(RTASK_PREFIX "%d / %d byte received \n",red,sz);
}


"rt_dev_read" gives negative Results. Whats wrong?


Thanks
Marco



  parent reply	other threads:[~2006-03-23 12:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-22 15:46 [Xenomai-help] read data from serial device Marco Jackel
2006-03-23 10:08 ` [Xenomai-help] " Marco Jackel
2006-03-23 12:41 ` Marco Jackel [this message]
2006-03-23 12:49   ` Philippe Gerum
2006-03-23 12:56     ` Marco Jackel
2006-03-23 13:22       ` Philippe Gerum
2006-03-24 12:20         ` Jan Kiszka
2006-03-23 12:56   ` Gilles Chanteperdrix
2006-03-23 13:21     ` Marco Jackel
2006-03-24 12:36 ` [Xenomai-help] " Jan Kiszka
2006-03-24 17:09   ` [Xenomai-help] " Marco Jackel
2006-03-24 17:23     ` Jan Kiszka
2006-03-24 17:42       ` Marco Jackel
2006-03-25  1:06       ` Marco Jackel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='dvu50v$5pq$1@domain.hid' \
    --to=ich@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.