All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Bachman Kharazmi <bahkha@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] adding PCI support to 16550A.c
Date: Thu, 13 Sep 2007 08:14:51 +0200	[thread overview]
Message-ID: <46E8D55B.3090806@domain.hid> (raw)
In-Reply-To: <46E87584.9020301@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

Jan Kiszka wrote:
> Bachman Kharazmi wrote:
>>> You can copy this code almost unmodified into an application and compile
>>> it against the Xenomai POSIX skin. The serial port configuration apart
>>> (same under Linux, though), it will open "rtser<whatever>", even if
>>> given like "/dev/rtser...", and work on that port as if it where a Linux
>>> one. Life can be simple, sometimes.
>> Simple? ;)
>> I've tried to write a c-program which basiclly should open the device
>> rtser0 and write 100x to it and then close.
>>
>> The simple program can be found here: http://pastebin.ca/693873
>>
>> I've connected the serial cable to a reading terminal, but there's no
>> data at all, when I run the binary. :/
>>
> 
> [Untested late-night hack after some Maß of beer - please excuse
> potential nonsense.]
> 
> POSIX skin
> ----------
> (use xeno-config --posix-cflags --posix-ldflags as compiler args)
> 
> #include bla bla bla
> 
> static const struct rtser_config write_config = {
>         .config_mask       = RTSER_SET_BAUD,
>         .baud_rate         = 115200,
> };
> 
> int main(int argc, char *argv[])
> {
> 	int fd;
> 
> 	fd = open("/dev/rtser0", O_RDWR);
> 	ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
> 	write(fd, argv[1], strlen(argv[1]));
> 	close(fd);
> 
> 	return 0;
> }
> 
> 
> Native skin
> -----------
> 
> ...
> int main(int argc, char *argv[])
> {
> 	int fd;
> 	RT_TASK task;
> 
> 	fd = rt_dev_open("/dev/rtser0", O_RDWR);

The first error, copy&paste: This must be just "rtser0".

> 	rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
> 
> 	rt_task_shadow(&task, NULL, 0, 0); /* may be done earlier,
>                                               but not later */
> 
> 	rt_dev_write(fd, argv[1], strlen(argv[1]));
> 	rt_dev_close(fd);
> 
> 	return 0;
> }
> 
> 
> Similar is imaginable for reading from the serial port.
> 
> Completed and tested versions, maybe also taking the baudrate as
> argument, will be happily accepted to the examples or tools repos.

BTW, a generic serial dump tool should, of course, also take the port
number as parameter.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2007-09-13  6:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-10 13:14 [Xenomai-help] adding PCI support to 16550A.c Bachman Kharazmi
2007-09-10 18:24 ` Jan Kiszka
2007-09-10 18:42   ` Bachman Kharazmi
2007-09-10 18:51     ` Jan Kiszka
2007-09-11 15:37       ` Bachman Kharazmi
2007-09-11 19:54         ` Jan Kiszka
2007-09-12 14:02           ` Bachman Kharazmi
2007-09-12 16:22             ` Bachman Kharazmi
2007-09-12 16:33               ` Gilles Chanteperdrix
2007-09-12 16:43                 ` Gilles Chanteperdrix
2007-09-12 19:30                   ` Bachman Kharazmi
2007-09-12 22:50                     ` Gilles Chanteperdrix
2007-09-12 16:32             ` Gilles Chanteperdrix
2007-09-12 19:17               ` Bachman Kharazmi
2007-09-12 23:25             ` Jan Kiszka
2007-09-13  6:14               ` Jan Kiszka [this message]
2007-09-13  9:38                 ` Bachman Kharazmi
2007-09-13  9:45                   ` Gilles Chanteperdrix
2007-09-13  9:51                     ` Bachman Kharazmi
2007-09-13  9:56                       ` Gilles Chanteperdrix
     [not found]                         ` <1ce16a2c0709130307k5e1955d4na694e90503084d0d@domain.hid>
2007-09-13 12:18                           ` Gilles Chanteperdrix
2007-09-13 12:41                             ` Bachman Kharazmi
2007-09-13 12:48                               ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2007-09-10 13:14 Bachman Kharazmi

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=46E8D55B.3090806@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=bahkha@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.