🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #5634

Re: Parallel port and interrupt servers

#5634
From: Valentin Pepelea
Date: Fri, 05 Oct 1990 03:21
82 lines
3042 bytes
In article <2275@trlluna.trl.oz> aduncan@rhea.trl.oz.au (Allan Duncan) writes:
>
> Expert assistance is being sought!

Well, I rewrote the parallel.device for 2.0, so I guess I qualify. I hope
you're catching this message, despite the late response. If you do, please
mail me, telling me you have received this message.

> I am currently (unsuccessfully) trying to write an interrupt server to
> run with the parallel port.
> ...
> So far, I have found out that on the installing side of things you have to -
>
> OpenResource ( "ciaa.resource" )  [ciaa is not mentioned in the RKM,
> ...
> OpenResource( "misc.resource" ) to get control of the CIA parallel port
> (sounds fair enough) via AllocMiscResource() for the port and bits.
> ...
> Set the DDR for some bits out, some in (I want asynchronous full duplex I/O).
> ..
> Set up an Interrupt node structure, and AddIntServer().
>
>	So far, so good!

Not exactly. You are creating an ICR interrupt server, not a general interrupt
server. Therefore you should use AddICRVector(), not AddIntServer(). Here's
the initialisation steps that I use in the parallel device:

	Intr = NULL;
	ControlInput();
	DataInput();

	Cia = (APTR) OpenResource("ciaa.resource");
	if (Cia == NULL) return(IOERR_OPENFAIL);

	Intr = (struct Interrupt *) MakeInterrupt("parallel.device",
		0,&AckServer);

	/* Written in Assembler */
	if (ResourceOK = (APTR)ObtainParallelResource())
	{
	    return(IOERR_OPENFAIL);
	}

	Disable();
	ClearACK();

	if (AddICRVector(Cia,CIAICRB_FLG,Intr))
	{
	    Enable();
	    return(IOERR_OPENFAIL);
	}

	/* Don't allow any *ACK processing until a CMD_READ or CMD_WRITE */
	DisableACK();	
	Enable();


>_PARServer:				; entry to our interrupt Server
> ...
>	andi.b	#CIAICRF_FLG,d0
>	beq.s	not_ours
> ...
>	moveq	#1,d0
>	RTS
>
>not_ours:
>	moveq	#0,d0			;pass on to next Server in chain
>        RTS				;return to exec

ICR interrupt servers do not need to return a special value in d0. Another
thing I have to remind you, the parallel port is not bidirectional, i.e.
you cannot read and write data at the same time using the regular centronics
handshaking. When you read the parallel port bits, you create a *DS pulse
just like when you write to those bits.

Valentin
-- 
The Goddess of democracy? "The tyrants    Name:    Valentin Pepelea
may destroy a statue,  but they cannot    Phone:   (215) 431-9327
kill a god."                              UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb    Claimer: I not Commodore spokesman be
Technical Details
Message-ID: <14894@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cbmvax!valentin
References: <2275@trlluna.trl.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cbmvax!valentin
From: valentin@cbmvax.commodore.com (Valentin Pepelea)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Parallel port and interrupt servers
Message-ID: <14894@cbmvax.commodore.com>
Date: 5 Oct 90 03:21:00 GMT
References: <2275@trlluna.trl.oz>
Reply-To: valentin@cbmvax.commodore.com (Valentin Pepelea)
Organization: Commodore, West Chester, PA
Lines: 82