Re: Reading and Writing on same serial port
- From: Paul Keinanen <keinanen@xxxxxx>
- Date: Mon, 16 Jan 2006 22:14:58 +0200
On Mon, 16 Jan 2006 15:40:42 -0000, Grant Edwards <grante@xxxxxxxx>
wrote:
>On 2006-01-16, emb in linux <haranath.t@xxxxxxxxx> wrote:
>
>> I have successfully communicated serial ports by running receive and
>> transmitting programs in different terminals.Now i need to read and
>> write data on same port.Here i am unable to do this.I am giving my
>> code.
>
>Care to tell us 1) what you think your code is supposed to do,
>and 2) what it actually does?
In addition, people who insists of using multiple tasks, processes or
threads (whatever they are called in each environment) to write to a
serial port have not considered what to do when there are multiple
pending write requests:
1) Do a byte by byte merge between each stream
2) Wait until the first transmission is completed, then send the next
frame
3) If a low priority thread has started transmission and a high
priority thread becomes active, send all the high priority bytes and
then continue with the low priority thread final bytes.
4) etc.
Also what to do with the received frame:
1) The next ready thread will get the next byte
2) Do a round robin between all ready threads
3) Based on the received byte, forward to a specific thread
4) Copy the received byte to all threads
5) etc.
The simplest thing would be to create a separate thread that owns the
port and implement any multiple access rule in that thread.
Paul
.
- Follow-Ups:
- Re: Reading and Writing on same serial port
- From: emb in linux
- Re: Reading and Writing on same serial port
- From: Captain Dondo
- Re: Reading and Writing on same serial port
- References:
- Reading and Writing on same serial port
- From: emb in linux
- Re: Reading and Writing on same serial port
- From: Grant Edwards
- Reading and Writing on same serial port
- Prev by Date: Re: Reading and Writing on same serial port
- Next by Date: Re: Reading and Writing on same serial port
- Previous by thread: Re: Reading and Writing on same serial port
- Next by thread: Re: Reading and Writing on same serial port
- Index(es):
Relevant Pages
|