Rev 3535 | Rev 4344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3535 | Rev 4343 | ||
---|---|---|---|
Line 103... | Line 103... | ||
103 | * Output byte to port |
103 | * Output byte to port |
104 | * |
104 | * |
105 | * @param port Port to write to |
105 | * @param port Port to write to |
106 | * @param val Value to write |
106 | * @param val Value to write |
107 | */ |
107 | */ |
108 | static inline void outb(uint16_t port, uint8_t val) |
108 | static inline void pio_write_8(uint16_t port, uint8_t val) |
109 | { |
109 | { |
110 | asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port) ); |
110 | asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port) ); |
111 | } |
111 | } |
112 | 112 | ||
113 | /** Word to port |
113 | /** Word to port |
Line 115... | Line 115... | ||
115 | * Output word to port |
115 | * Output word to port |
116 | * |
116 | * |
117 | * @param port Port to write to |
117 | * @param port Port to write to |
118 | * @param val Value to write |
118 | * @param val Value to write |
119 | */ |
119 | */ |
120 | static inline void outw(uint16_t port, uint16_t val) |
120 | static inline void pio_write_16(uint16_t port, uint16_t val) |
121 | { |
121 | { |
122 | asm volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port) ); |
122 | asm volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port) ); |
123 | } |
123 | } |
124 | 124 | ||
125 | /** Double word to port |
125 | /** Double word to port |
Line 127... | Line 127... | ||
127 | * Output double word to port |
127 | * Output double word to port |
128 | * |
128 | * |
129 | * @param port Port to write to |
129 | * @param port Port to write to |
130 | * @param val Value to write |
130 | * @param val Value to write |
131 | */ |
131 | */ |
132 | static inline void outl(uint16_t port, uint32_t val) |
132 | static inline void pio_write_32(uint16_t port, uint32_t val) |
133 | { |
133 | { |
134 | asm volatile ("outl %l0, %w1\n" : : "a" (val), "d" (port) ); |
134 | asm volatile ("outl %l0, %w1\n" : : "a" (val), "d" (port) ); |
135 | } |
135 | } |
136 | 136 | ||
137 | /** Byte from port |
137 | /** Byte from port |
Line 139... | Line 139... | ||
139 | * Get byte from port |
139 | * Get byte from port |
140 | * |
140 | * |
141 | * @param port Port to read from |
141 | * @param port Port to read from |
142 | * @return Value read |
142 | * @return Value read |
143 | */ |
143 | */ |
144 | static inline uint8_t inb(uint16_t port) |
144 | static inline uint8_t pio_read_8(uint16_t port) |
145 | { |
145 | { |
146 | uint8_t val; |
146 | uint8_t val; |
147 | 147 | ||
148 | asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) ); |
148 | asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) ); |
149 | return val; |
149 | return val; |
Line 154... | Line 154... | ||
154 | * Get word from port |
154 | * Get word from port |
155 | * |
155 | * |
156 | * @param port Port to read from |
156 | * @param port Port to read from |
157 | * @return Value read |
157 | * @return Value read |
158 | */ |
158 | */ |
159 | static inline uint16_t inw(uint16_t port) |
159 | static inline uint16_t pio_read_16(uint16_t port) |
160 | { |
160 | { |
161 | uint16_t val; |
161 | uint16_t val; |
162 | 162 | ||
163 | asm volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port) ); |
163 | asm volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port) ); |
164 | return val; |
164 | return val; |
Line 169... | Line 169... | ||
169 | * Get double word from port |
169 | * Get double word from port |
170 | * |
170 | * |
171 | * @param port Port to read from |
171 | * @param port Port to read from |
172 | * @return Value read |
172 | * @return Value read |
173 | */ |
173 | */ |
174 | static inline uint32_t inl(uint16_t port) |
174 | static inline uint32_t pio_read_32(uint16_t port) |
175 | { |
175 | { |
176 | uint32_t val; |
176 | uint32_t val; |
177 | 177 | ||
178 | asm volatile ("inl %w1, %l0 \n" : "=a" (val) : "d" (port) ); |
178 | asm volatile ("inl %w1, %l0 \n" : "=a" (val) : "d" (port) ); |
179 | return val; |
179 | return val; |