added include/portio.h; using it to update cursor position in kputc()
git-svn-id: svn://anubis/hos/trunk@55 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
1 parent
1dd8250048
commit
08af04897c
2 files changed
+50
No files matched your search
Executable
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
#ifndef PORTIO_H
|
||||
#define PORTIO_H
|
||||
|
||||
#include "hos_types.h"
|
||||
|
||||
#define outportb(port, val) \
|
||||
__asm__ __volatile__ ("outb %%al, %%dx" : : "a" (val), "d" (port));
|
||||
|
||||
#define outportw(port, val) \
|
||||
__asm__ __volatile__ ("outw %%ax, %%dx" : : "a" (val), "d" (port));
|
||||
|
||||
#define outportd(port, val) \
|
||||
__asm__ __volatile__ ("outl %%eax, %%dx" : : "a" (val), "d" (port));
|
||||
|
||||
#define inportb(port) \
|
||||
({ \
|
||||
u8_t val; \
|
||||
__asm__ __volatile__ ("inb %%dx, %%al" : "=a" (val) : "d" (port)); \
|
||||
val; \
|
||||
});
|
||||
|
||||
#define inportw(port) \
|
||||
({ \
|
||||
u16_t val; \
|
||||
__asm__ __volatile__ ("inw %%dx, %%al" : "=a" (val) : "d" (port)); \
|
||||
val; \
|
||||
});
|
||||
|
||||
#define inportd(port) \
|
||||
({ \
|
||||
u32_t val; \
|
||||
__asm__ __volatile__ ("inl %%dx, %%al" : "=a" (val) : "d" (port)); \
|
||||
val; \
|
||||
});
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user