]>
Commit | Line | Data |
---|---|---|
f1584bb0 JW |
1 | /* io.h |
2 | * I/O port access macros | |
3 | * NetWatch system management mode administration console | |
4 | * | |
5 | * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved. | |
6 | * This program is free software; you can redistribute and/or modify it under | |
7 | * the terms found in the file LICENSE in the root of this source tree. | |
8 | * | |
9 | */ | |
10 | ||
11 | ||
035d7af7 JW |
12 | #ifndef __IO_H |
13 | #define __IO_H | |
14 | ||
36ce375d JP |
15 | #define inb(port) __extension__ ({ unsigned char val; asm volatile("inb %%dx, %0" : "=a" ((unsigned char)(val)) : "d" ((unsigned short)(port))); val; }) |
16 | #define inw(port) __extension__ ({ unsigned short val; asm volatile("inw %%dx, %0" : "=a" ((unsigned short)(val)) : "d" ((unsigned short)(port))); val; }) | |
17 | #define inl(port) __extension__ ({ unsigned long val; asm volatile("inl %%dx, %0" : "=a" ((unsigned long)(val)) : "d" ((unsigned short)(port))); val; }) | |
18 | #define outb(port, val) __extension__ ({ asm volatile("outb %0, %%dx" : : "a" ((unsigned char)(val)) , "d" ((unsigned short)(port))); }) | |
19 | #define outw(port, val) __extension__ ({ asm volatile("outw %0, %%dx" : : "a" ((unsigned short)(val)) , "d" ((unsigned short)(port))); }) | |
20 | #define outl(port, val) __extension__ ({ asm volatile("outl %0, %%dx" : : "a" ((unsigned long)(val)) , "d" ((unsigned short)(port))); }) | |
035d7af7 JW |
21 | |
22 | #endif |