Format
#include <conio.h> /* also in <builtin.h> */ unsigned long _outpd( const unsigned int port, const unsigned long value );
Language Level: Extension
_outpd writes an unsigned long value
to the specified port. The port number must be a value within the range 0 to
65 535 inclusive. The unsigned long value
must be within the range 0 to 4 294 967 295 inclusive.
Note: _outpd is a built-in function, which means it is implemented as an inline instruction and has no backing code in the library. For this reason:
You can run code containing this function only at ring zero. Otherwise, an invalid instruction exception is generated.
Return Value
_outpd returns the unsigned long value
that was output to the specified port.
There is no error return value, and _outpd does not set errno.
Example
This example uses _outpd to write a
doubleword value to a specified output port and return the data
written.
#include <builtin.h>
#define LOWER 0 #define UPPER1 65535 #define UPPER2 4294967295
int Add1(int j);
volatile long g;
enum fruit {apples=10, bananas, cantaloupes};
enum fruit f = cantaloupes;
int arr[] = {cantaloupes, bananas, apples};
union
{
volatile int i;
volatile char ch;
} un;
int main(void)
{
unsigned long l;
volatile const short c = 0;
un.i = bananas * f;
g = _outpd(0,LOWER);
/* ============================= */
/* Types of port number passed : */
/* ----------------------------- */
l = _outpd(UPPER1, UPPER2); /* - #define constant */
l = _outpd(un.i ,f); /* - element of union */
l = _outpd(Add1(c), apples); /* - return value from a */
/* function call */
/* ----------------------------- */
l = _outpd(_outpw(255,Add1(LOWER)),6);
return 0;
}
int Add1(int j)
{
j += 1;
return j;
}
![]()
_inp -- Read Byte from Input
Port
_inpw -- Read
Unsigned Short from Input Port
_inpd -- Read
Doubleword from Input Port
_outp -- Write
Byte to Output Port
_outpw -- Write
Word to Output Port
<builtin.h>
<conio.h>