NetcanOS
Netcan OS is an operation system for x86 PCs, for learning how os works.
io.h
浏览该文件的文档.
1 /*************************************************************************
2  > File Name: kernel/io.h
3  > Author: Netcan
4  > Blog: http://www.netcan666.com
5  > Mail: 1469709759@qq.com
6  > Created Time: 2018-07-08 Sun 13:17:16 CST
7  ************************************************************************/
8 #include <stddef.h>
9 #include <stdio.h>
10 
11 #ifndef IO_H
12 #define IO_H
13 #define ASSERT(cond, msg) if(!(cond)) { printf("%s at %s:%d\n", msg, __FILE__, __LINE__); while(1); }
14 typedef unsigned int u32;
15 typedef signed int s32;
16 typedef unsigned short u16;
17 typedef signed short s16;
18 typedef unsigned char u8;
19 typedef signed char s8;
20 
21 // in 指令,从IO端口读取数据
22 u8 port_byte_in(u16 port);
23 u16 port_word_in(u16 port);
24 
25 // out 指令,往IO端口输出数据
26 void port_byte_out(u16 port, u8 data);
27 void port_word_out(u16 port, u16 data);
28 #endif
signed short s16
Definition: io.h:17
unsigned short u16
Definition: io.h:16
unsigned char u8
Definition: io.h:18
signed char s8
Definition: io.h:19
u16 port_word_in(u16 port)
从IO端口读取16位数据。
Definition: io.c:38
signed int s32
Definition: io.h:15
u8 port_byte_in(u16 port)
从IO端口读取8位数据。
Definition: io.c:14
void port_byte_out(u16 port, u8 data)
从IO端口写入8位数据。
Definition: io.c:30
void port_word_out(u16 port, u16 data)
从IO端口写入16位数据。
Definition: io.c:48
unsigned int u32
Definition: io.h:14