git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: cut off some bloats in intr_ctx
[lunaix-os.git]
/
lunaix-os
/
includes
/
hal
/
io.h
diff --git
a/lunaix-os/includes/hal/io.h
b/lunaix-os/includes/hal/io.h
index c57de5984a060979e87689d95e77efa375288737..f4f61920f4ad809b8d18821add13a0eff30c9f53 100644
(file)
--- a/
lunaix-os/includes/hal/io.h
+++ b/
lunaix-os/includes/hal/io.h
@@
-1,7
+1,7
@@
#ifndef __LUNAIX_IO_H
#define __LUNAIX_IO_H
#ifndef __LUNAIX_IO_H
#define __LUNAIX_IO_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
static inline uint8_t
io_inb(int port)
static inline uint8_t
io_inb(int port)
@@
-41,10
+41,10
@@
io_insw(int port, void* addr, int cnt)
: "memory", "cc");
}
: "memory", "cc");
}
-static inline u
int
32_t
+static inline u32_t
io_inl(int port)
{
io_inl(int port)
{
- u
int
32_t data;
+ u32_t data;
asm volatile("inl %w1,%0" : "=a"(data) : "d"(port));
return data;
}
asm volatile("inl %w1,%0" : "=a"(data) : "d"(port));
return data;
}
@@
-106,9
+106,18
@@
io_outsl(int port, const void* addr, int cnt)
}
static inline void
}
static inline void
-io_outl(int port, u
int
32_t data)
+io_outl(int port, u32_t data)
{
asm volatile("outl %0,%w1" : : "a"(data), "d"(port));
}
{
asm volatile("outl %0,%w1" : : "a"(data), "d"(port));
}
+static inline void
+io_delay(int counter)
+{
+ asm volatile(" test %0, %0\n"
+ " jz 1f\n"
+ "2: dec %0\n"
+ " jnz 2b\n"
+ "1: dec %0" ::"a"(counter));
+}
#endif /* __LUNAIX_IO_H */
#endif /* __LUNAIX_IO_H */