Marco Jackel wrote:
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?
Which negative code is returned exactely?
Thanks
Marco
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
--
Philippe.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help