2017-11-02 08:10:11 -04:00
|
|
|
#ifndef KERNELMQ_INCLUDED_ASM
|
|
|
|
#define KERNELMQ_INCLUDED_ASM 1
|
2017-11-02 07:57:17 -04:00
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
inline static unsigned char inportb(unsigned short port);
|
|
|
|
inline static unsigned short inportw(unsigned short port);
|
|
|
|
inline static unsigned int inportd(unsigned short port);
|
2017-11-02 07:57:17 -04:00
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
inline static void outportb(unsigned short port, unsigned char value);
|
|
|
|
inline static void outportw(unsigned short port, unsigned short value);
|
|
|
|
inline static void outportd(unsigned short port, unsigned int value);
|
2017-11-02 07:57:17 -04:00
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
unsigned char inportb(unsigned short port)
|
2017-11-02 07:57:17 -04:00
|
|
|
{
|
|
|
|
register unsigned char result;
|
|
|
|
asm volatile("inb %1, %0" : "=a" (result) : "dN" (port));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
unsigned short inportw(unsigned short port)
|
2017-11-02 07:57:17 -04:00
|
|
|
{
|
|
|
|
register unsigned short result;
|
|
|
|
asm volatile("inw %1, %0" : "=a" (result) : "dN" (port));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
unsigned int inportd(unsigned short port)
|
2017-11-02 07:57:17 -04:00
|
|
|
{
|
|
|
|
register unsigned int result;
|
|
|
|
asm volatile("ind %1, %0" : "=a" (result) : "dN" (port));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
void outportb(unsigned short port, unsigned char value)
|
2017-11-02 07:57:17 -04:00
|
|
|
{
|
|
|
|
asm volatile("outb %1, %0" : : "dN" (port), "a" (value));
|
|
|
|
}
|
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
void outportw(unsigned short port, unsigned short value)
|
2017-11-02 07:57:17 -04:00
|
|
|
{
|
|
|
|
asm volatile("outw %1, %0" : : "dN" (port), "a" (value));
|
|
|
|
}
|
|
|
|
|
2017-11-03 00:04:14 -04:00
|
|
|
void outportd(unsigned short port, unsigned int value)
|
2017-11-02 07:57:17 -04:00
|
|
|
{
|
|
|
|
asm volatile("outd %1, %0" : : "dN" (port), "a" (value));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|