Changeset abf04a54 in mainline for uspace/lib/c/arch/ia32/include/ddi.h
- Timestamp:
- 2011-08-20T13:39:25Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4e6577c
- Parents:
- a0fc4be (diff), 667a4f8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/ia32/include/ddi.h
ra0fc4be rabf04a54 41 41 static inline uint8_t pio_read_8(ioport8_t *port) 42 42 { 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; 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 } 52 54 } 53 55 54 56 static inline uint16_t pio_read_16(ioport16_t *port) 55 57 { 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; 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 } 65 69 } 66 70 67 71 static inline uint32_t pio_read_32(ioport32_t *port) 68 72 { 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; 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 } 78 84 } 79 85 80 86 static inline void pio_write_8(ioport8_t *port, uint8_t val) 81 87 { 82 asm volatile ( 83 "outb %b[val], %w[port]\n" 84 :: [val] "a" (val), [port] "d" (port) 85 ); 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 } 86 96 } 87 97 88 98 static inline void pio_write_16(ioport16_t *port, uint16_t val) 89 99 { 90 asm volatile ( 91 "outw %w[val], %w[port]\n" 92 :: [val] "a" (val), [port] "d" (port) 93 ); 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 } 94 108 } 95 109 96 110 static inline void pio_write_32(ioport32_t *port, uint32_t val) 97 111 { 98 asm volatile ( 99 "outl %[val], %w[port]\n" 100 :: [val] "a" (val), [port] "d" (port) 101 ); 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 } 102 120 } 103 121
Note:
See TracChangeset
for help on using the changeset viewer.