Jump to content

DosPortAccess: Difference between revisions

From EDM2
Created page with "image:legacy.png This function has been eliminated since OS/2 2.0 [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false] ==Descript..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[image:legacy.png]]
This function has been eliminated since OS/2 2.0 [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false]
==Description==
This call requests or releases access to ports for I/O privilege.
This call requests or releases access to ports for I/O privilege.


==Syntax==
==Syntax==
<PRE>
  DosPortAccess (Reserved, TypeOfAccess, FirstPort, LastPort)
  DosPortAccess


    (Reserved, TypeOfAccess, FirstPort, LastPort)
</PRE>
==Parameters==
==Parameters==
; Reserved (USHORT) - input : Must be set to zero.  
;Reserved (USHORT) - input : Must be set to zero.
 
;TypeOfAccess (USHORT) - input : A request for or release of access to a port.
; TypeOfAccess (USHORT) - input : A request for or release of access to a port.
::0 - Request access
 
::1 - Release access.
'''Value        Definition'''
; FirstPort (USHORT) - input : Starting (low) number in a contiguous range or a single port.
0       Request access
1       Release access.  
 
; FirstPort (USHORT) - input : Starting (low) number in a contiguous range or a single port.  
 
; LastPort (USHORT) - input : Ending (high) number in a contiguous range or a single port. If only one port is being used, FirstPort and LastPort should both be set to this port.
; LastPort (USHORT) - input : Ending (high) number in a contiguous range or a single port. If only one port is being used, FirstPort and LastPort should both be set to this port.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
*0 NO_ERROR
Return code descriptions are:
*5 ERROR_ACCESS_DENIED
 
* 0       NO_ERROR
* 5       ERROR_ACCESS_DENIED  


==Remarks==
==Remarks==
Note that CLI/STI privilege is also granted automatically. There is no need to make an additional call to DosCLIAccess.
Note that CLI/STI privilege is also granted automatically. There is no need to make an additional call to [[DosCLIAccess]].


Applications that perform I/O to port(s) in IOPL segments must request port access from the operating system.
Applications that perform I/O to port(s) in IOPL segments must request port access from the operating system.


An application with no IOPL segments that accesses a device through a device driver or by an interface package such as VIO, does not need to issue this call. The device driver or interface package is responsible for obtaining the necessary I/O access.  
An application with no IOPL segments that accesses a device through a device driver or by an interface package such as VIO, does not need to issue this call. The device driver or interface package is responsible for obtaining the necessary I/O access.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSDEVICES
#define INCL_DOSDEVICES
Line 46: Line 31:
USHORT  rc = DosPortAccess(Reserved, TypeOfAccess, FirstPort, LastPort);
USHORT  rc = DosPortAccess(Reserved, TypeOfAccess, FirstPort, LastPort);


USHORT           0;            /* 0 */
USHORT 0;            /* 0 */
USHORT           TypeOfAccess;  /* Request or release */
USHORT TypeOfAccess;  /* Request or release */
USHORT           FirstPort;    /* First port number */
USHORT FirstPort;    /* First port number */
USHORT           LastPort;      /* Last port number */
USHORT LastPort;      /* Last port number */


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosPortAccess:FAR
EXTRN  DosPortAccess:FAR
Line 67: Line 52:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 05:20, 26 January 2020

This call requests or releases access to ports for I/O privilege.

Syntax

DosPortAccess (Reserved, TypeOfAccess, FirstPort, LastPort)

Parameters

Reserved (USHORT) - input
Must be set to zero.
TypeOfAccess (USHORT) - input
A request for or release of access to a port.
0 - Request access
1 - Release access.
FirstPort (USHORT) - input
Starting (low) number in a contiguous range or a single port.
LastPort (USHORT) - input
Ending (high) number in a contiguous range or a single port. If only one port is being used, FirstPort and LastPort should both be set to this port.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 5 ERROR_ACCESS_DENIED

Remarks

Note that CLI/STI privilege is also granted automatically. There is no need to make an additional call to DosCLIAccess.

Applications that perform I/O to port(s) in IOPL segments must request port access from the operating system.

An application with no IOPL segments that accesses a device through a device driver or by an interface package such as VIO, does not need to issue this call. The device driver or interface package is responsible for obtaining the necessary I/O access.

Bindings

C

#define INCL_DOSDEVICES

USHORT  rc = DosPortAccess(Reserved, TypeOfAccess, FirstPort, LastPort);

USHORT  0;             /* 0 */
USHORT  TypeOfAccess;  /* Request or release */
USHORT  FirstPort;     /* First port number */
USHORT  LastPort;      /* Last port number */

USHORT  rc;            /* return code */

MASM

EXTRN  DosPortAccess:FAR
INCL_DOSDEVICES     EQU 1

PUSH   WORD    0             ;Reserved (must be zero)
PUSH   WORD    TypeOfAccess  ;Request or release
PUSH   WORD    FirstPort     ;First port number
PUSH   WORD    LastPort      ;Last port number
CALL   DosPortAccess

Returns WORD