-
Notifications
You must be signed in to change notification settings - Fork 0
/
hal.c
43 lines (32 loc) · 1.1 KB
/
hal.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*------------------------------------------------------------------------------
//
// Hardware abstraction level (HAL) library
// (c) maisvendoo, 04.07.2013
//
//----------------------------------------------------------------------------*/
#include "hal.h"
/*------------------------------------------------------------------------------
// Put byte in port
//----------------------------------------------------------------------------*/
void outb(u16int port, u8int value)
{
asm volatile ("outb %1, %0"::"dN"(port),"a"(value));
}
/*------------------------------------------------------------------------------
// Get byte from port
//----------------------------------------------------------------------------*/
u8int inb(u16int port)
{
u8int ret;
asm volatile ("inb %1, %0":"=a"(ret):"dN"(port));
return ret;
}
/*------------------------------------------------------------------------------
// Get byte from port
//----------------------------------------------------------------------------*/
u16int inw(u16int port)
{
u16int ret;
asm volatile ("inw %1, %0":"=a"(ret):"dN"(port));
return ret;
}