#ifndef __CIO_H__ #define __CIO_H__ #include #define port_out_b(port, value) ({ \ asm volatile ( "out dx, al" \ : \ : "a" (value), "d" (port) \ : ); \ }) #define port_out_w(port, value) ({ \ asm volatile ( "out dx, ax" \ : \ : "a" (value), "d" (port) \ : ); \ }) #define port_out_d(port, value) ({ \ asm volatile ( "out dx, eax" \ : \ : "a" (value), "d" (port) \ : ); \ }) #define port_in_b(port) ({ \ uint8_t value; \ asm volatile ( "in al, dx" \ : "=a" (value) \ : "d" (port) \ : ); \ value; \ }) #define port_in_w(port) ({ \ uint16_t value; \ asm volatile ( "in ax, dx" \ : "=a" (value) \ : "d" (port) \ : ); \ value; \ }) #define port_in_d(port) ({ \ uint32_t value; \ asm volatile ( "in eax, dx" \ : "=a" (value) \ : "d" (port) \ : ); \ value; \ }) #define io_wait() ({ port_out_b(0x80, 0x00); }) #define disable_interrupts() ({ asm volatile ("cli"); }) #define enable_interrupts() ({ asm volatile ("sti"); }) #endif