|
|
@ -1,5 +1,5 @@ |
|
|
|
// Function to read a byte from port
|
|
|
|
// Function to read a byte from port
|
|
|
|
unsigned char port_byte_in(unsigned short port) { |
|
|
|
unsigned char port_inb(unsigned short port) { |
|
|
|
unsigned char res; |
|
|
|
unsigned char res; |
|
|
|
__asm__("in %%dx, %%al" : "=a" (res) : "d" (port)); |
|
|
|
__asm__("in %%dx, %%al" : "=a" (res) : "d" (port)); |
|
|
|
|
|
|
|
|
|
|
@ -7,13 +7,13 @@ unsigned char port_byte_in(unsigned short port) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// to write a byte to port
|
|
|
|
// to write a byte to port
|
|
|
|
void port_byte_out(unsigned short port, unsigned char data) { |
|
|
|
void port_outb(unsigned short port, unsigned char data) { |
|
|
|
__asm__("out %%al, %%dx" : :"a" (data), "d" (port));
|
|
|
|
__asm__("out %%al, %%dx" : :"a" (data), "d" (port));
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Read word from port
|
|
|
|
// Read word from port
|
|
|
|
unsigned short port_word_in(unsigned short port) { |
|
|
|
unsigned short port_inw(unsigned short port) { |
|
|
|
unsigned short res; |
|
|
|
unsigned short res; |
|
|
|
__asm__("in %%dx, %%ax" : "=a" (res) : "d" (port)); |
|
|
|
__asm__("in %%dx, %%ax" : "=a" (res) : "d" (port)); |
|
|
|
|
|
|
|
|
|
|
@ -21,6 +21,6 @@ unsigned short port_word_in(unsigned short port) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// write word to port
|
|
|
|
// write word to port
|
|
|
|
void port_word_out(unsigned short port, unsigned short data) { |
|
|
|
void port_outw(unsigned short port, unsigned short data) { |
|
|
|
__asm__("out %%ax, %%dx" : :"a" (data), "d" (port)); |
|
|
|
__asm__("out %%ax, %%dx" : :"a" (data), "d" (port)); |
|
|
|
} |
|
|
|
} |
|
|
|