[comp.sys.mac.programmer] Serial Drivers @ Interrupt Time

beard@ux1.lbl.gov (Patrick C Beard) (11/04/89)

Hi NetLand.

I am attempting to use the serial drivers at VBL time.  One question
I have is how to ask the input serial driver how much data it currently
has in its input buffers.  Inside Macintosh states that the calls PBStatus
and PBControl may move memory, and yet PBStatus is the call I need to make
to find out the number of bytes in the serial driver buffer.  How do I do it?
I find that posting asynchronous reads is very inefficient (how many bytes
to read is the hardest thing to come up with) and was wondering if there
is a more direct way to ask the serial driver how many bytes are in the
buffer I give it.

Thanks.


-------------------------------------------------------------------------------
-  Patrick Beard, Macintosh Programmer                        (beard@lbl.gov) -
-  Berkeley Systems, Inc.  ".......<dead air>.......Good day!" - Paul Harvey  -
-------------------------------------------------------------------------------

ariza@srava.sra.JUNET (Michiharu Ariza) (11/06/89)

In article <4134@helios.ee.lbl.gov> beard@ux1.lbl.gov (Patrick C Beard) writes:
>I am attempting to use the serial drivers at VBL time.  One question
>I have is how to ask the input serial driver how much data it currently
>has in its input buffers.  Inside Macintosh states that the calls PBStatus
>and PBControl may move memory, and yet PBStatus is the call I need to make
>to find out the number of bytes in the serial driver buffer.  How do I do it?

I believe you can simply call PBStatus to get the number of available bytes
without fear of moving memory. IM states that PBStatus may move memory since
there are cscode varieties that may cause moving memory, but I cannot see any
reason to move memory in order to calculate the number of available bytes,
and actually it does not. I confirmed this by disassembling the serial
driver code on my IIcx using TMON. Of course this is not stated in IM and
may not be true on future machines and OS. Be warned.

				Michiharu (Michael) Ariza
				SRA, Inc., Tokyo, Japan