Changes in uspace/lib/c/arch/ia32/include/ddi.h [c8f70eb:d161715] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/ia32/include/ddi.h
rc8f70eb rd161715 41 41 static inline uint8_t pio_read_8(ioport8_t *port) 42 42 { 43 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 44 uint8_t val; 45 asm volatile ( 46 "inb %w[port], %b[val]\n" 47 : [val] "=a" (val) 48 : [port] "d" (port) 49 ); 50 return val; 51 } else { 52 return (uint8_t) *port; 53 } 43 uint8_t val; 44 45 asm volatile ( 46 "inb %w[port], %b[val]\n" 47 : [val] "=a" (val) 48 : [port] "d" (port) 49 ); 50 51 return val; 54 52 } 55 53 56 54 static inline uint16_t pio_read_16(ioport16_t *port) 57 55 { 58 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 59 uint16_t val; 60 asm volatile ( 61 "inw %w[port], %w[val]\n" 62 : [val] "=a" (val) 63 : [port] "d" (port) 64 ); 65 return val; 66 } else { 67 return (uint16_t) *port; 68 } 56 uint16_t val; 57 58 asm volatile ( 59 "inw %w[port], %w[val]\n" 60 : [val] "=a" (val) 61 : [port] "d" (port) 62 ); 63 64 return val; 69 65 } 70 66 71 67 static inline uint32_t pio_read_32(ioport32_t *port) 72 68 { 73 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 74 uint32_t val; 75 asm volatile ( 76 "inl %w[port], %[val]\n" 77 : [val] "=a" (val) 78 : [port] "d" (port) 79 ); 80 return val; 81 } else { 82 return (uint32_t) *port; 83 } 69 uint32_t val; 70 71 asm volatile ( 72 "inl %w[port], %[val]\n" 73 : [val] "=a" (val) 74 : [port] "d" (port) 75 ); 76 77 return val; 84 78 } 85 79 86 80 static inline void pio_write_8(ioport8_t *port, uint8_t val) 87 81 { 88 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 89 asm volatile ( 90 "outb %b[val], %w[port]\n" 91 :: [val] "a" (val), [port] "d" (port) 92 ); 93 } else { 94 *port = val; 95 } 82 asm volatile ( 83 "outb %b[val], %w[port]\n" 84 :: [val] "a" (val), [port] "d" (port) 85 ); 96 86 } 97 87 98 88 static inline void pio_write_16(ioport16_t *port, uint16_t val) 99 89 { 100 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 101 asm volatile ( 102 "outw %w[val], %w[port]\n" 103 :: [val] "a" (val), [port] "d" (port) 104 ); 105 } else { 106 *port = val; 107 } 90 asm volatile ( 91 "outw %w[val], %w[port]\n" 92 :: [val] "a" (val), [port] "d" (port) 93 ); 108 94 } 109 95 110 96 static inline void pio_write_32(ioport32_t *port, uint32_t val) 111 97 { 112 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 113 asm volatile ( 114 "outl %[val], %w[port]\n" 115 :: [val] "a" (val), [port] "d" (port) 116 ); 117 } else { 118 *port = val; 119 } 98 asm volatile ( 99 "outl %[val], %w[port]\n" 100 :: [val] "a" (val), [port] "d" (port) 101 ); 120 102 } 121 103
Note:
See TracChangeset
for help on using the changeset viewer.