Delta Tau GEO BRICK LV User Manual

Page of 440
Turbo PMAC User Manual 
Writing a Host Communications Program
 
391
 
Initializing the Interrupt Controller 
To start, write to the Turbo PMAC PIC’s Initialization Command Words (ICWs) to set up the PIC 
properly.  Although this IC is on Turbo PMAC, it is mapped into the PC’s port space as two registers at 
Turbo PMAC’s base address plus 8 and 9. 
To do this, perform the following steps: 
1.  Write a byte of 17(hex) to [PMAC base address + 8].  This sets up ICW1 for edge-triggered 
interrupts. 
2.  Write a byte of 08(hex) to [PMAC base address + 9].  This sets up ICW2. 
3.  Write a byte of 03(hex) to [PMAC base address + 9].  This sets up ICW4 for 8086-mode operation. 
4.  Write a byte of FF(hex) to [PMAC base address + 9].  This writes to Operation Control Word 1 to 
mask all eight interrupts into the Turbo PMAC PIC. 
Unmasking Interrupts 
When you are ready to accept interrupts from PMAC, unmask the interrupt(s) into the PMAC PIC that 
you want active.  You write a one-byte argument to {PMAC base address + 9] in which every masked 
interrupt to the Turbo PMAC PIC is represented by a 1; and every unmasked interrupt is represented by a 
0.  For instance, to unmask IR4 alone, the argument would be EF(hex); to unmask IR5 alone, the 
argument would be DF(hex).   
At this point, unmask the interrupt being used on the PC’s PIC.  First, disable the PC interrupts (TurboC 
command: disable(); ).  Next, read the current mask word at I/O port address 21(hex) with a command 
such as: 
ch = inportb(0x21)
  
Then unmask the new interrupt that will be used by performing a bit-by-bit AND between the current 
mask word and a mask word that would enable only the new interrupt line -- EF(hex) for IRQ4, F8(hex) 
for IRQ3.  The C command for this is: 
ch = ch & 0xef 
The resulting new mask word is written back to I/O port address 21(hex) with: 
outportb (0x21, ch) 
Finally, re-enable the PC interrupts (TurboC command: enable();).  This completes the setup procedure. 
Using the Interrupts 
To react to an interrupt in actual use, write an interrupt service routine.  Exactly how this is done depends 
on the operating system and the programming language.  Consult the documentation for these items for 
further details. 
PCOMM32 Library Support 
Delta Tau’s PCOMM32 and PCOMM32PRO programming libraries for Microsoft Windows operating 
systems support ISA and PCI interrupts and handle the setup automatically through its routines.  Consult 
the documentation for these libraries for details. 
VME Bus Communications 
A VME-bus Turbo PMAC communicates over the VME bus as a slave device through a set of sixteen 8-
bit “mailbox registers,” each of which can hold one character and can be accessed from both the bus and 
the Turbo PMAC processor.  Optionally, there is also a dual-ported RAM IC with 8192 shared 16-bit 
registers that can be used for either ASCII-text communications or transfer of binary values.