UPS Monitor

HyperDisk can monitor the status of any Uninterruptable Power Supply (UPS) that
has a serial port.  This is very useful for machines that are run unattended
such as file servers and communiation workstations.  By monitoring the UPS,
HyperDisk can help prevent data loss by shutting down whenever the computer is
not running on normal power.  This helps prevent any data that would be in a
"staged write" buffer from being lost by turning off staged writes whenever
normal power is not being used.

The UPS Monitoring function is very flexible and can monitor any I/O port
for active signals.  Multiple signals can be monitored as well as signals with
different polarity.

The UPS Monitoring function can work in conjuntion with other monitors such
as the monitors built into Lantastic and Novell.


Use the UP: parameter to set up the UPS Monitoring function.

UP:{IoPort}:{IoPolarity}:{IoMask}:{CacheMask}[:{PollSeconds}[:{PollCount}]]

  Items in {} are required, item in [] optional.


    IoPort  Input port address. This is the address of the port to be monitored.
            This number must be in Hexidecimal format.


IoPolarity  Inverts sense of input port bits.  Normally the monitor looks for a
            "high" signal for a true occurance of a state.  By switching the
            polarity, the monitor will look for a low occurance of the state.
            0 does not change value
            1 inverts bits sense

    IoMask  Determines which bits to test for non-zero conditions.
            0 drops bit from test
            1 retains IoPort bit value.
            Non-Zero results indicates active UPS (AC power off)
            Zero results indicates inactive UPS (AC power on)

 CacheMask  is a bit field
            1 disables function if this bit occurs
            0 no change to function if this bit occurs

            Bit BitName        A one (1) will disable the corresponding function

             0  StagedFloppy   Stage Write floppy drive write operations
             1  StagedHard     Stage Write hard drive write operations
             2  VerifyFloppy   Verify floppy drive write operations
             3  VerifyHard     Verify hard drive write operations
             4  Reserved0      Reserved always 0
             5  Reserved1      Reserved always 0
             6  FloppyEnable   Enable floppy caching
             7  CacheEnabled   Enable all caching functions


PollSeconds Sets the period in seconds to sample IoPort value.  Every nn
            seconds the I/O port will be checked for changes in status.

PollCount   Sets the number of identical IoPort samples before changeing
            the cache state.  This tells the monitor how many times it should
            wait after seeing a change in the state of the UPS before it should
            change the status of the cache.  This helps keep the cache from
            changing states if the UPS just goes onto battery power for a
            moment such as during a brown out.



IoMask Values for COM port based UPS monitoring system

  To set the IOMask values you must determine which pin on the I/O port you
  are going to use to monitor the UPS.  Most of the UPS' use the Carrier
  Detect Pin on a PC serial port to monitor the UPS status.

  To calculate the IOPort address to use you must first determine which
  port you are going to be monitoring, then, calculate the offset to the
  port register that you will be using.  In most cases you will be using a
  serial port at either COM1 or COM2 and monitoring the Modem Status Register.
  To monitor the Modem Status Register on COM1 you would calculate the following
  address:

  COM1 is generally located at 3F8.
  COM2 is generally located at 2F8.
  Modem Status Register is 6 Bytes from the port address.
  The IOPort address would be 3F8 (COM1) + 6 (MSR) = 3FE for COM1
  The IOPort address would be 2F8 (COM2) + 6 (MSR) = 2FE for COM2


Below is a list of the common pins used to monitor UPS functions.

9-Pin Port  25-Pin Port   Signal Name     IoMask     IoPolarity

Pin 1       Pin-8         Carrier Detect    80            00

Pin 6       Pin-6         Data Set Ready    20            00

Pin 8       Pin-5         Clear To Send     10            00

Pin 9       Pin-22        Ring Indicator    40            00


To make your own cable for the American Power Conversion (APC) UPS follow the
pin-out details below:


 APC 9 pin interface               Computer 9 pin interface

 Cable end: Male (Pins)            Cable end: Female (Sockets)


   Pin 2 - AC Power Fault------------------Pin 1 - Modem Data Carrier Detect

   Pin 4 - Signal Ground-------------------Pin 5 - Signal Ground


Example:

 Monitor COM2, Modem Status port: Bit 7, Carrier Detect, normal polarity
 If power fails disable Staged Writes on both hard and floppy drives
 30 second sample period, 3 matching samples indicates active/inactive UPS

   HYPERDK UP:2FE:0:80:3:30:3
