Delta Tau GEO BRICK LV User Manual

Page of 440
Turbo PMAC User Manual 
Writing a Host Communications Program
 
387
 
{Base + 2} holds the handshaking status bits; even though this is called the Interrupt Status Register, it 
can be used for polled communications with the host:  The Write-Ready Bit (bit 1) is true when PMAC is 
ready to have the PC write it a character; and the Read-Ready Bit (bit 0) is true when PMAC is ready to 
have the PC read a character.   
Setting up the Port 
No real setup is required for the host port, although it is advisable to write zero values to the high-byte 
and middle-byte registers to clear them.  The following sample C code segment does this: 
outportb (combase + 5, 0); 
  /* 
Clear 
high-byte 
register 
*/ 
outportb (combase + 6, 0); 
 
 
/* Clear mid-btye register */ 
It is a good idea in the initial set up to compute a timeout value, related to the host computer’s speed.  As 
the host polls PMAC to see if it is ready to communicate, a counter increments; if the counter exceeds the 
timeout value, the host should give up on this attempt to talk to PMAC.  Depending on the circumstances, 
it should either just try again later (as when waiting for some asynchronous communications) or assume 
there is an error condition. 
Sending a Character 
To send a character, the host waits for the Write-Ready Bit to go true, and then writes the character to the 
output port, as this sample C code segment shows: 
i = 0;   
 
 
 
 
 
/* Reset counter */ 
while (i++<timeout && !(inportb(combase+2) & 2));
 
/* Loop until bit true */ 
if (i < timeout) outportb(combase+7, outchar); 
 
/* Write character */ 
Reading a Character 
To read a character, the host waits for the Read-Ready Bit to go true, and then reads the character from 
the input port, as this sample C code segment shows: 
i=0;
 
while (i++<timeout && !(inportb(combase+2) & 1));
 
/* Loop until bit true */ 
if (i < timeout) inchar = inportb(combase+7); 
 
/* Read character */ 
ISA/PCI Interrupts 
The ISA-bus and PCI-bus versions of the Turbo PMAC have a built-in programmable interrupt controller 
(PIC) that can be used to let Turbo PMAC interrupt the host computer over the bus.  Each controller has 
its own set of signals that can be used to interrupt the host computer, up to eight of which can be used at 
any one time.  The detailed description of the signals available for interrupt are shown in the hardware 
reference manual for each controller; the signals for presently existing controllers are summarized below. 
The Turbo PMAC-PC for the ISA bus uses a commercially available 8259 PIC chip.  All other Turbo 
PMAC designs integrate PCI logic that is similar, but not identical, to the 8259 into integrated bus logic 
ICs.  The differences are noted below.   
Host Computer Interrupt Lines 
ISA Bus 
For ISA-bus Turbo PMAC boards, the interrupt line used on the ISA bus is selected by a jumper on the 
Turbo PMAC.  The following table lists the possibilities for each of these controllers.  Only one of these 
jumpers for a controller should be on at any given time. 
ISA-bus 
Interrupt  IRQ2 IRQ3 IRQ4 IRQ5 IRQ7 IRQ10 IRQ11 IRQ12 IRQ14 IRQ15
Turbo 
PMAC-PC 
E86 E81 E82 E83 E84 E80 E79 E78 E77 E76 
Turbo 
PMAC2-PC  x x x x x E7 E8 E9 E10 
E15 
Turbo PMAC2-PC 
Ultralite 
x x x x x E7 E8 E9  x E10