HPlogo Asynchronous Serial Communications Programmer's Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 4 Using FDEVICECONTROL

Syntax Description

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

While FDEVICECONTROL performs some of the same device control functions performed by FCONTROL, the two intrinsics look very different from each other when you use them in a program. FCONTROL uses just three parameters, through which you specify a devicefile, define the control operation to be performed, and, depending on the control operation, pass or receive specific information that may be required for that operation.

FDEVICECONTROL requires the use of a greater number of parameter values. For operations that can be performed by either FCONTROL or FDEVICECONTROL, it is easier to use FCONTROL. The following is the syntax for FDEVICECONTROL:

               I16V    UDS     I16V    I16V
FDEVICECONTROL(filenum,buffer,length,controlcode,
                I16V  U16V   U16
                  parm1,parm2,fserrorcode);

FDEVICECONTROL is used for a variety of file control operations, each of which is appropriate for controlling a specific type of devicefile.

The controlcode parameter determines the control operation that will be performed. The only control operation which effects asynchronous devicefiles is controlcode value 192. It sends device control directives to an asynchronous device.

Refer to Table 8-7 “Valid FDEVICECONTROL Controlcode Values” for a list of other valid controlcode values and the operations they perform. For more information on these operations refer to the MPE/iX Intrinsics Reference Manuals.

When controlcode is 192, parm1 determines the specific control directive to be sent to the devicefile. parm1 must contain one of the control directive values specified in Chapter 4 “Using FDEVICECONTROL”

parm2 determines the Read/Write access to be imposed on the directive. The Read/Write access setting must be valid for the control directive specified in parm1. Set parm2 to 1 for Read access, 2 for Write access, or 3 for both Read and Write access.

For example, if you were to call FDEVICECONTROL with controlcode set to 192 and parm1 set to 57, which is the control directive used to obtain the subsystem break character, you would need to set parm2 to 1, since only Read access is allowed for that control directive.

If, however, parm1 were set to 36, which is the control directive used to define the backspace character, you could set parm2 to 1, 2, or 3. In this case, setting parm2 to 1 would return the current backspace character to your program, while setting it to 2 would actually change the backspace character to whatever new character you pass in the call (through the buffer parameter). Setting parm2 to 3 would both return the previous value and change the backspace character to the new value passed in the call.

Some control directives do not permit all possible values of parm2 to be used with them. Table 8-8 lists the allowable parm2 access values for each of the valid control directives that may be specified in parm1.

The filenum parameter specifies the file number, as obtained through a previous call to FOPEN or HPFOPEN, of the devicefile on which the control operation is to be performed.

The buffer parameter passes and returns the data associated with the control directive being performed. For example, if the control directive specified in parm1 is 3, which sets the line speed for a device, buffer must contain the new linespeed setting (and will return the previous speed setting if parm2 is set to Read/Write access).

The length parameter sets the length of buffer. Positive values indicate the length in half words. Negative values indicate the length in bytes. Usually length will be set to 1, indicating that buffer is 1 half word long.

The fserrorcode parameter returns error information to your program. If no error occurs during execution, fserrorcode contains a 0. If an error occurs, fserrorcode returns the file system error code corresponding to that error. You will need to call FCHECK for more information about the error that occurred.

Feedback to webmaster