HP 3000 Manuals

TECHNICAL ARTICLES [ COMMUNICATOR 3000/XL: XL REL. 2.2 (A.41.00) ] MPE/iX Communicators


COMMUNICATOR 3000/XL: XL REL. 2.2 (A.41.00)

Chapter 6  TECHNICAL ARTICLES 

HPDEVCONTROL Intrinsic 

by Jonathan M. Sauer--Commercial Systems Division 

The new device control intrinsic is called HPDEVCONTROL. This intrinsic
provides a way to access specific peripheral functionality without the
device being opened.  More specifically, it allows access to specific
peripheral features that previously could not be taken advantage of by
the operating system.  This intrinsic is intended to allow you to have
access to device utilities.  It is not for general control (reading,
writing, etc.)  With this intrinsic, the operating system can take
advantage of device features not available through the conventional file
system.  The File System tables will be updated by this intrinsic as
necessary.

Syntax 
_____________________________________
|                                   |
|     HPDEVCONTROL                  |
|                  ( status,        |
|                    ldev,          |
|                    controlcode,   |
|                    param          |
|                  );               |
_____________________________________

Peripheral command sequences are performed by the HPDEVCONTROL intrinsic.
One command can be executed at a time by specifying the appropriate ldev,
control code, and parameter.

Parameter 

status           I32 bit integer (returned) 
                 An integer indicating what error occurred.

ldev             packed array of 200 char (required) 
                 A packed array indicating which device is to be used.
                 This array of characters needs to be delimited with "
                 and 0 filled.

                 i.e., "00000007" Would specify ldev 7

controlcode      I32 bit integer (required) 
                 An integer specifying what control to perform.

param            I32 bit integer (optional) 
                 An integer specifying additional parameters or options.
                 (Not used at this time)

HPDEVCONTROL PARAMETER VALUES 

The following table illustrates the valid control codes values and
parameter values that are supported.

          Parameters 
-----------------------------------------------------------------------------------------------
|                           |                   |                                             |
|    Control Code Value     |    Param Value    |                 Description                 |
|                           |                   |                                             |
-----------------------------------------------------------------------------------------------
|                           |                   |                                             |
| 100                       |        n/a        | Load Media:  Attempts to load the media.    |
|                           |                   |                                             |
| 101                       |        n/a        | Online:  Programmatically places the        |
|                           |                   | peripheral online.                          |
|                           |                   |                                             |
-----------------------------------------------------------------------------------------------

SPECIAL CONSIDERATIONS 

The user will need to have Nonsharable Device "ND" capability in order to
use the HPDEVCONTROL intrinsic.

ERRORS 

The following errors will be returned to you in the status parameter when
an error is found executing the intrinsic.

          Error Statuses 

-----------------------------------------------------------------------------------------------
|                                             |              |                                |
|               Error Condition               |    Value     |         When Returned          |
|                                             |              |                                |
-----------------------------------------------------------------------------------------------
|                                             |              |                                |
| IS_ACCESS_VIOLATION                         |   -196465    | The device is already owned.   |
|                                             |              |                                |
| IS_INVALID_OPERATION                        |   -1048433   | The control code is not        |
|                                             |              | defined or not valid for the   |
|                                             |              | device type.                   |
|                                             |              |                                |
| IS_INVALID_DEVICE_TYPE                      |   -262031    | The device type is not         |
|                                             |              | supported by this intrinsic.   |
|                                             |              |                                |
| IS_INSUFFICIENT_PRIV_LEVEL                  |   -130929    | The user does not have ND      |
|                                             |              | capability.                    |
|                                             |              |                                |
| IS_UNDEFINED_ERROR                          |   -1703793   | The intrinsic can not complete |
|                                             |              | the request because of HLIO    |
|                                             |              | problems.                      |
|                                             |              |                                |
| IS_BOUNDS_VIOLATION                         |   -1179505   | Returned when one of the       |
|                                             |              | parameters are of the wrong    |
|                                             |              | type.                          |
|                                             |              |                                |
| llio_hw_problem                             |   -2162575   | Returned when the device is    |
|                                             |              | loaded online and a load       |
|                                             |              | command is issued.             |
|                                             |              |                                |
| llio_dev_power_on                           |   -2883471   | Returned on the first I/O      |
|                                             |              | after a device powerfail.      |
|                                             |              | (Application should retry the  |
|                                             |              | I/O.)                          |
|                                             |              |                                |
| llio_not_implemented                        |   -2883471   | The device does not support    |
|                                             |              | the functionality.             |
|                                             |              |                                |
-----------------------------------------------------------------------------------------------

SAMPLE PROGRAM 

This is a sample program that takes input from the terminal and calls
HPDEVCONTROL with the given information.  Note conversion of the string
to the packed array.

     program test(input,output);
     type
       atype = packed array [1..200] of char;
     var
       which_device : atype;                { Packed array to accept ldev type }
       dev_type : string[15];           { string type to read users input  }
       status : integer;              { Status returned from hpdevcontrol}
       option : integer;              { option to preform                }
       parameter : integer;              { parameter to send to hpdevcontrol}
       ans : char;                 { var use to repeat if necessary   }

     procedure hpdevcontrol intrinsic;

     begin
       repeat
         prompt('Please enter ldev          -> ');
         readln(dev_type);

         {------------------------------------------------------}
         { convert string type to packed array for hpdevcontrol }
         {------------------------------------------------------}
         strmove(20,dev_type,1,which_device,1);

         prompt('Please enter option        -> ');
         readln(option);
         parameter := 0;
         HPDEVCONTROL(status,which_device,option,parameter);
         writeln;
         writeln('I have called hpdevcontrol and was returned -> ',status);
         prompt('do you want to continue? y/n ');
         readln(ans);
       until ((ans = 'N') or (ans = 'n'));
     end.

In the example provided, the tape drive at ldev 7 is placed online.  The
program is expecting the inputs of "0000007" for the ldev and 101 to
place the tape drive online.

Example Run 

:run test;xl="intrixl.pub.sys"  
Please enter ldev      -> "00000007"  
Please enter option    -> 101 
I have called hpdevcontrol and was returned -> 0 
do you want to continue?  y/n n 
:



MPE/iX Communicators