Rev 3929 | Rev 4017 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3929 | Rev 3948 | ||
|---|---|---|---|
| Line 79... | Line 79... | ||
| 79 | 79 | ||
| 80 | asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port)); |
80 | asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port)); |
| 81 | return val; |
81 | return val; |
| 82 | } |
82 | } |
| 83 | 83 | ||
| - | 84 | /** Word from port |
|
| - | 85 | * |
|
| - | 86 | * Get word from port |
|
| - | 87 | * |
|
| - | 88 | * @param port Port to read from |
|
| - | 89 | * @return Value read |
|
| - | 90 | */ |
|
| - | 91 | static inline uint16_t pio_read_16(ioport16_t *port) |
|
| - | 92 | { |
|
| - | 93 | uint16_t val; |
|
| - | 94 | ||
| - | 95 | asm volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port)); |
|
| - | 96 | return val; |
|
| - | 97 | } |
|
| - | 98 | ||
| - | 99 | /** Double word from port |
|
| - | 100 | * |
|
| - | 101 | * Get double word from port |
|
| - | 102 | * |
|
| - | 103 | * @param port Port to read from |
|
| - | 104 | * @return Value read |
|
| - | 105 | */ |
|
| - | 106 | static inline uint32_t pio_read_32(ioport32_t *port) |
|
| - | 107 | { |
|
| - | 108 | uint32_t val; |
|
| - | 109 | ||
| - | 110 | asm volatile ("inl %w1, %0 \n" : "=a" (val) : "d" (port)); |
|
| - | 111 | return val; |
|
| - | 112 | } |
|
| - | 113 | ||
| 84 | /** Byte to port |
114 | /** Byte to port |
| 85 | * |
115 | * |
| 86 | * Output byte to port |
116 | * Output byte to port |
| 87 | * |
117 | * |
| 88 | * @param port Port to write to |
118 | * @param port Port to write to |
| Line 91... | Line 121... | ||
| 91 | static inline void pio_write_8(ioport8_t *port, uint8_t val) |
121 | static inline void pio_write_8(ioport8_t *port, uint8_t val) |
| 92 | { |
122 | { |
| 93 | asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port)); |
123 | asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port)); |
| 94 | } |
124 | } |
| 95 | 125 | ||
| - | 126 | /** Word to port |
|
| - | 127 | * |
|
| - | 128 | * Output word to port |
|
| - | 129 | * |
|
| - | 130 | * @param port Port to write to |
|
| - | 131 | * @param val Value to write |
|
| - | 132 | */ |
|
| - | 133 | static inline void pio_write_16(ioport16_t *port, uint16_t val) |
|
| - | 134 | { |
|
| - | 135 | asm volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port)); |
|
| - | 136 | } |
|
| - | 137 | ||
| - | 138 | /** Double word to port |
|
| - | 139 | * |
|
| - | 140 | * Output double word to port |
|
| - | 141 | * |
|
| - | 142 | * @param port Port to write to |
|
| - | 143 | * @param val Value to write |
|
| - | 144 | */ |
|
| - | 145 | static inline void pio_write_32(ioport32_t *port, uint32_t val) |
|
| - | 146 | { |
|
| - | 147 | asm volatile ("outl %0, %w1\n" : : "a" (val), "d" (port)); |
|
| - | 148 | } |
|
| - | 149 | ||
| 96 | /** Swap Hidden part of GS register with visible one */ |
150 | /** Swap Hidden part of GS register with visible one */ |
| 97 | static inline void swapgs(void) |
151 | static inline void swapgs(void) |
| 98 | { |
152 | { |
| 99 | asm volatile("swapgs"); |
153 | asm volatile("swapgs"); |
| 100 | } |
154 | } |