Delta Tau GEO BRICK LV User Manual

Page of 440
 
Turbo PMAC User Manual 
386 
Writing a Host Communications Program 
i = 0;   
 
 
 
 
/* Reset counter */ 
outportb(combase + 4, 2);  
 
 
/* Set port for input */ 
while (i++<timeout && (inportb(combase+5)==0);
 /* Loop until bit true */ 
if (i < timeout) inchar = inportb(combase);   
/* Get char. unless timed out */ 
disable();     
/* Disable interrupts */ 
outportb(combase + 4, 0);  
 
 
/* Set port for output */ 
enable(); 
 
 
 
 
/* Re-enable interrupts */ 
To be able to read an entire line in a single routine, only turn around the port at the beginning and end of 
the line. 
ISA/PCI Host Port Communications 
Host Port Structure 
The host port interface of PMAC, used directly for communications over the ISA and PCI busses, 
occupies 11 consecutive addresses of a 16-address region in the I/O space of the host computer (it is not 
memory mapped).  On the host side, these registers are accessed with byte-write and byte-read 
commands, such as outportb, inportb, outp, and inp.  On the PMAC side, the PMAC firmware takes care 
of the direct access to these registers, in response to commands from the host. 
For the ISA bus, the location of the first of these 11 registers in the host computer’s I/O space (the “base 
address”) is selected by the settings of jumpers E91-E92, E66-E71 on Turbo PMAC boards and by the 
settings of the S1 DIP switches on Turbo PMAC2 boards.  Refer to the Talking to Turbo PMAC section 
or the individual Hardware Reference manual for actual setting information.  The addresses of these 
registers range from base address to base address + 10. 
For the PCI bus, the location of the base address of these registers is automatically determined by the host 
computer’s operating system.  Refer to the operating system documentation for instructions as to how to 
determine where the operating system located these registers.  If using Delta Tau’s PCOMM32PRO 
library for Microsoft Windows operating systems, consult the documentation for PCOMM32PRO for 
instructions for determining the host-port base address in this environment. 
Register Functions 
Each of these eleven registers has its own function for host communications, although only a few of them 
are used commonly, and some are not used at all.  The functions of the registers are: 
Base + 0: 
Interrupt Control Register 
Base + 1: 
Command Vector Register 
Base + 2: 
Interrupt Status Register 
Base + 3: 
Interrupt Vector Register 
Base + 4: 
(Unused) 
Base + 5: 
High-Byte Data Transmit and Receive  
Base + 6: 
Middle-Byte Data Transmit and Receive 
Base + 7: 
Low-Byte Data Transmit and Receive 
Base + 8: 
Interrupt Controller Command Word 0 
Base + 9: 
Interrupt Controller Command Word 1 
Base + 10: 
Interrupt Acknowledge Word 
Registers for Simple Polled Communications 
Basic polled communications can be accomplished with just two of these addresses.  {Base + 7} holds 
each byte (character) as it is passed to or from the PMAC.  The read and write registers are separate, so 
you do not need to worry about overwriting a character sent in the other direction.