RtEnablePortIo

RtEnablePortIo enables direct I/O port access from user context.

Syntax

Copy
BOOL RtEnablePortIo(
   PUCHAR StartPort,
   ULONG nNumberOfBytes
);

Parameters

StartPort

The first port to have direct I/O permissions enabled by this call. Each I/O space address points to a single byte. For ports that represent 2-byte or 4-byte locations, the appropriate number of I/O space addresses must be enabled, or an exception will be encountered.

nNumberOfBytes

An unsigned 64-bit integer indicating the number of addresses or bytes to enable, starting at StartPort.

Return Value

If the function completes successfully, it returns TRUE. If invalid parameters are specified, it returns FALSE.

Remarks

This function currently has no impact on Process determinism. This call is a NO-OP (no operation) when issued from Process applications.

RtEnablePortIo enables direct user access to the specified range of I/O addresses. On the Pentium processor, there are 216-1 = 65,535 byte-wide I/O port addresses. Two-byte word and four-byte double word ports take two and four I/O port addresses, respectively, and fall on even word and long word addresses (i.e., divisible by two and four), respectively.

The address for which direct I/O is to be enabled is passed in StartPort, cast as a pointer to an unsigned character (i.e., a single-byte quantum). Generally, this address represents a hardware register or port, so only a single byte needs to be enabled (i.e., nNumberOfBytes is set to 1). If the location represents a two-byte word or four-byte double word port, then the parameter nNumberOfBytes should reflect the width of the I/O port. Note that nNumberOfBytes can also be used to enable permission for an entire range of addresses, independent of their data widths.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

Rtapi.h rtkrnl.lib

See Also: