Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/x86_64-linux-gnu/sys/io.h
$ cat -n /usr/include/x86_64-linux-gnu/sys/io.h 1 /* Copyright (C) 1996-2024 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16
. */ 17 18 #ifndef _SYS_IO_H 19 #define _SYS_IO_H 1 20 21 #include
22 23 __BEGIN_DECLS 24 25 /* If TURN_ON is TRUE, request for permission to do direct i/o on the 26 port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O 27 permission off for that range. This call requires root privileges. 28 29 Portability note: not all Linux platforms support this call. Most 30 platforms based on the PC I/O architecture probably will, however. 31 E.g., Linux/Alpha for Alpha PCs supports this. */ 32 extern int ioperm (unsigned long int __from, unsigned long int __num, 33 int __turn_on) __THROW; 34 35 /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to 36 access any I/O port is granted. This call requires root 37 privileges. */ 38 extern int iopl (int __level) __THROW; 39 40 #if defined __GNUC__ && __GNUC__ >= 2 41 42 static __inline unsigned char 43 inb (unsigned short int __port) 44 { 45 unsigned char _v; 46 47 __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); 48 return _v; 49 } 50 51 static __inline unsigned char 52 inb_p (unsigned short int __port) 53 { 54 unsigned char _v; 55 56 __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); 57 return _v; 58 } 59 60 static __inline unsigned short int 61 inw (unsigned short int __port) 62 { 63 unsigned short _v; 64 65 __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); 66 return _v; 67 } 68 69 static __inline unsigned short int 70 inw_p (unsigned short int __port) 71 { 72 unsigned short int _v; 73 74 __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); 75 return _v; 76 } 77 78 static __inline unsigned int 79 inl (unsigned short int __port) 80 { 81 unsigned int _v; 82 83 __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); 84 return _v; 85 } 86 87 static __inline unsigned int 88 inl_p (unsigned short int __port) 89 { 90 unsigned int _v; 91 __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); 92 return _v; 93 } 94 95 static __inline void 96 outb (unsigned char __value, unsigned short int __port) 97 { 98 __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); 99 } 100 101 static __inline void 102 outb_p (unsigned char __value, unsigned short int __port) 103 { 104 __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), 105 "Nd" (__port)); 106 } 107 108 static __inline void 109 outw (unsigned short int __value, unsigned short int __port) 110 { 111 __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); 112 113 } 114 115 static __inline void 116 outw_p (unsigned short int __value, unsigned short int __port) 117 { 118 __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), 119 "Nd" (__port)); 120 } 121 122 static __inline void 123 outl (unsigned int __value, unsigned short int __port) 124 { 125 __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); 126 } 127 128 static __inline void 129 outl_p (unsigned int __value, unsigned short int __port) 130 { 131 __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), 132 "Nd" (__port)); 133 } 134 135 static __inline void 136 insb (unsigned short int __port, void *__addr, unsigned long int __count) 137 { 138 __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count) 139 :"d" (__port), "0" (__addr), "1" (__count)); 140 } 141 142 static __inline void 143 insw (unsigned short int __port, void *__addr, unsigned long int __count) 144 { 145 __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count) 146 :"d" (__port), "0" (__addr), "1" (__count)); 147 } 148 149 static __inline void 150 insl (unsigned short int __port, void *__addr, unsigned long int __count) 151 { 152 __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count) 153 :"d" (__port), "0" (__addr), "1" (__count)); 154 } 155 156 static __inline void 157 outsb (unsigned short int __port, const void *__addr, 158 unsigned long int __count) 159 { 160 __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count) 161 :"d" (__port), "0" (__addr), "1" (__count)); 162 } 163 164 static __inline void 165 outsw (unsigned short int __port, const void *__addr, 166 unsigned long int __count) 167 { 168 __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count) 169 :"d" (__port), "0" (__addr), "1" (__count)); 170 } 171 172 static __inline void 173 outsl (unsigned short int __port, const void *__addr, 174 unsigned long int __count) 175 { 176 __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count) 177 :"d" (__port), "0" (__addr), "1" (__count)); 178 } 179 180 #endif /* GNU C */ 181 182 __END_DECLS 183 #endif /* _SYS_IO_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™