[comp.sys.amiga.tech] Come on PEOPLE...

gilgan@ug.cs.dal.ca (S.O.D.) (02/13/90)

 I have recieved many replies(like almost 10...) from my posting asking 
 for help on
 using the SERIAL port(modem)..they all asked "PLEASE foward me any info
 you recieve.." but no replies(at least via email, I believe there was one
 reply on the net that I got) telling me how to do anything..
 SOMEBODY must know how to do it or have source on how to open, read to,
 write from Serial.. 
 apparently many people are having the same problem as I am, hence all
 the requests to me, so your words wouldn't fall on deaf ears..

 thanks again...
 Tom

cmcmanis@stpeter.Sun.COM (Chuck McManis) (02/14/90)

In article <1990Feb12.223912.7167@ug.cs.dal.ca> (tom) writes:
> I have recieved many replies(like almost 10...) from my posting asking 
> for help on
> using the SERIAL port(modem)..they all asked "PLEASE foward me any info
> you recieve.." but no replies(at least via email, I believe there was one
> reply on the net that I got) telling me how to do anything..
> SOMEBODY must know how to do it or have source on how to open, read to,
> write from Serial.. 
> apparently many people are having the same problem as I am, hence all
> the requests to me, so your words wouldn't fall on deaf ears..

This seems a good testamonial to my case on the problems with the Amiga 
"serial" architecture.

Anyway, the answer isn't simple. It goes something like this :

Somewhere in your main routine you need to open the serial.device,
to do this you have to allocated an extended IORequest structure,
and created a reply port. There are descriptions on how to do this
in the RKM but basically the flow is something like :

	...
	struct IOExtSer Myserialstruct;

	port = CreatePort(0, 0);
	if (!port) 
		abort("Can't create port!");
	Myserialstruct.IOSer.io_Message.ReplyPort = port;
	error = OpenDevice("serial.device", 0, &Myserialstruct, 0);
	if (error)
		abort("Can't open serial.device!");

	...

char
read_a_character()
{
	char	a;

	Myserialstruct.IOSer.io_Command = READ;
	Myserialstruct.IOSer.io_Length = 1;
	Myserialstruct.IOSer.io_Data = &a;
	DoIO(&Myserialstruct);
	if (Myserialstruct.IOSer.io_Error != 0)
		return (0);
	else 
		return (a);
}

Etc etc for the write and set parameters calls. 

If you want to just check to see if a character is available and
return if there isn't one, then you will need to look up doing 
asynchronous I/O using SendIO/WaitIo.

Read and understand the following sections of the available manuals
and then ask more specific questions if you want to get answers :
	RKM Libraries and Devices : Chapter on serial.device
				    Chapter on Exec/IO
				    
	RKM AutoDocs and Includes :  devices/serial.h
				     serial.device

Sorry about not going into great detail, but you have to meet us
at least halfway.

--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@Eng.Sun.COM
These opinions are my own and no one elses, but you knew that didn't you.
"If it didn't have bones in it, it wouldn't be crunchy now would it?!"

Jim.Locker@afitamy.fidonet.org (Jim Locker) (02/26/90)

I have complete source for a telecomm program called Aterm that properly 
handles the serial port.  I have tried to send it to you in a message, but the 
board that I am going through evidently has limits on the length of messages 
and I have been unsuccessful.  If you are interested in this code, EMail me at 
afitamy and we will see what we can arrange.

Jim Locker


--  
-------------------------------------------------
Jim Locker - via FidoNet node 1:110/300
UUCP: uunet!dayvb!afitamy!Jim.Locker
ARPA: Jim.Locker@afitamy.fidonet.org
-------------------------------------------------|
>>>> The // Air Force Institute of Technology    |
>       //     Amiga Users BBS/UFGateway         |
>    \ //    Dayton, Ohio  (513)-252-7681        |     
>     X/               1:110/300                 |
-------------------------------------------------|