Changeset 26e7d6d in mainline for uspace/lib/c/arch/ia32/include/ddi.h
- Timestamp:
- 2011-09-19T16:31:00Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a347a11
- Parents:
- 3842a955 (diff), 086290d (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
r3842a955 r26e7d6d 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 46 asm volatile ( 47 "inb %w[port], %b[val]\n" 48 : [val] "=a" (val) 49 : [port] "d" (port) 50 ); 51 52 return val; 53 } else 54 return (uint8_t) *port; 52 55 } 53 56 54 57 static inline uint16_t pio_read_16(ioport16_t *port) 55 58 { 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; 59 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 60 uint16_t val; 61 62 asm volatile ( 63 "inw %w[port], %w[val]\n" 64 : [val] "=a" (val) 65 : [port] "d" (port) 66 ); 67 68 return val; 69 } else 70 return (uint16_t) *port; 65 71 } 66 72 67 73 static inline uint32_t pio_read_32(ioport32_t *port) 68 74 { 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; 75 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 76 uint32_t val; 77 78 asm volatile ( 79 "inl %w[port], %[val]\n" 80 : [val] "=a" (val) 81 : [port] "d" (port) 82 ); 83 84 return val; 85 } else 86 return (uint32_t) *port; 78 87 } 79 88 80 89 static inline void pio_write_8(ioport8_t *port, uint8_t val) 81 90 { 82 asm volatile ( 83 "outb %b[val], %w[port]\n" 84 :: [val] "a" (val), [port] "d" (port) 85 ); 91 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 92 asm volatile ( 93 "outb %b[val], %w[port]\n" 94 :: [val] "a" (val), [port] "d" (port) 95 ); 96 } else 97 *port = val; 86 98 } 87 99 88 100 static inline void pio_write_16(ioport16_t *port, uint16_t val) 89 101 { 90 asm volatile ( 91 "outw %w[val], %w[port]\n" 92 :: [val] "a" (val), [port] "d" (port) 93 ); 102 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 103 asm volatile ( 104 "outw %w[val], %w[port]\n" 105 :: [val] "a" (val), [port] "d" (port) 106 ); 107 } else 108 *port = val; 94 109 } 95 110 96 111 static inline void pio_write_32(ioport32_t *port, uint32_t val) 97 112 { 98 asm volatile ( 99 "outl %[val], %w[port]\n" 100 :: [val] "a" (val), [port] "d" (port) 101 ); 113 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 114 asm volatile ( 115 "outl %[val], %w[port]\n" 116 :: [val] "a" (val), [port] "d" (port) 117 ); 118 } else 119 *port = val; 102 120 } 103 121
Note:
See TracChangeset
for help on using the changeset viewer.