comp.lang.ada
 help / color / mirror / Atom feed
From: Alexander Korolev <antonovkablog@gmail.com>
Subject: Re: Stream_Element_Array
Date: Wed, 14 Sep 2011 10:16:09 -0700 (PDT)
Date: 2011-09-14T10:16:09-07:00	[thread overview]
Message-ID: <276b8d0a-5b3c-4559-a275-98620657cc2f@s30g2000pri.googlegroups.com> (raw)
In-Reply-To: 28u4e86fk8gn$.ialexttobgr0$.dlg@40tude.net

On Sep 14, 7:08 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Wed, 14 Sep 2011 07:48:47 -0700 (PDT), Alexander Korolev wrote:
> > I am talking to serial port via GNAT.Serial_Communication. The
> > Buffer it offers is Stream_Element_Array.
>
> In that case it is OK to use Stream_Element.
>
> > And I need to do
> > computations (implemented assuming that the buffer is ok :) ) over the
> > buffer
> > before do the call.One of the formats receiving part expects is:
> >|Start(8bit|Length - 16 bit|Element1-8bit|Element-16bit|Checksum|
> > Write (S_Port,Buffer)
>
> I usually allocate an output buffer in the "device object". The output
> index as I described earlier is also stored there. The application level
> fills the buffer and in the end call something like Device.Flush. Flush
> calculates the checksum over 1..Index - 1, stores the result and finally
> calls Write.
>
> BTW, it is highly recommended to use asynchronous read, or a synchronous
> one from an independent task. You should always be ready to read next byte
> from the device. Otherwise you risk to run into a deadlock upon protocol
> errors.
>
> You might also wish to write asynchronously (to improve performance), but
> beware that most serial devices, at least those I saw, are broken and just
> crash when full duplex I/O attempted.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de
"I usually allocate an output buffer in the "device object"

I've been advised and that worked out for many in few cases to use
Volatile_Streams.Memory_Resident_Stream.
You may like to take a look (in GNAT Examples) if you have not
already did
before. I was getting a compilation error like I posted before (see my
second post)
but now it's gone and I hope I got what I wanted but further autopsy
will show ...
I will post the result if it will work this way.

" or a synchronous one from an independent task"
Sure. This is were I call the serial port






  reply	other threads:[~2011-09-14 17:16 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-14  3:13 Stream_Element_Array Alexander Korolev
2011-09-14  5:29 ` Stream_Element_Array Per Sandberg
2011-09-14  8:34   ` Stream_Element_Array Alexander Korolev
2011-09-14  8:31 ` Stream_Element_Array Simon Wright
2011-09-14  9:09   ` Stream_Element_Array Alexander Korolev
2011-09-14  9:40     ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14  9:41       ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 10:18         ` Stream_Element_Array Simon Wright
2011-09-14 12:42           ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 16:20             ` Stream_Element_Array Simon Wright
2011-09-14 19:53               ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 10:53       ` Stream_Element_Array Simon Wright
2011-09-14 12:48         ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 14:48           ` Stream_Element_Array Alexander Korolev
2011-09-14 15:08             ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 17:16               ` Alexander Korolev [this message]
2011-09-14 20:13                 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 21:29                   ` Stream_Element_Array Alexander Korolev
2011-09-15  8:20                     ` Stream_Element_Array Dmitry A. Kazakov
2011-09-15 18:58                       ` Stream_Element_Array Alexander Korolev
2011-09-15 20:48                         ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16  0:20                           ` Stream_Element_Array Alexander Korolev
2011-09-15 19:15                       ` Stream_Element_Array Alexander Korolev
2011-09-15 20:11                         ` Stream_Element_Array Simon Wright
2011-09-15 20:34                           ` Stream_Element_Array Alexander Korolev
2011-09-15 21:42                             ` Stream_Element_Array Simon Wright
2011-09-15 21:50                               ` Stream_Element_Array Simon Wright
2011-09-16  0:01                                 ` Stream_Element_Array Alexander Korolev
2011-09-16  0:18                               ` Stream_Element_Array Adam Beneschan
2011-09-16  7:22                                 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 10:21                                   ` Stream_Element_Array Simon Wright
2011-09-16 12:13                                     ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 17:20                                       ` Stream_Element_Array Simon Wright
2011-09-16 19:32                                         ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 22:18                                           ` Stream_Element_Array Simon Wright
2011-09-17  8:18                                             ` Stream_Element_Array Dmitry A. Kazakov
2011-09-19 23:22                                   ` Stream_Element_Array Randy Brukardt
2011-09-15 21:28                           ` Stream_Element_Array Alexander Korolev
2011-09-15  2:33                   ` Stream_Element_Array Alexander Korolev
2011-09-19 23:11           ` Stream_Element_Array Randy Brukardt
2011-09-14 12:19 ` Stream_Element_Array Gautier write-only
2011-09-16 11:17 ` Stream_Element_Array anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox