File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,22 @@ pub fn outb(port: u16, cmd: u8) {
88 }
99}
1010
11+ pub fn outw ( port : u16 , cmd : u16 ) {
12+ unsafe {
13+ asm ! ( "out dx, ax" ,
14+ in( "dx" ) port,
15+ in( "ax" ) cmd) ;
16+ }
17+ }
18+
19+ pub fn outl ( port : u16 , cmd : u32 ) {
20+ unsafe {
21+ asm ! ( "out dx, eax" ,
22+ in( "dx" ) port,
23+ in( "eax" ) cmd) ;
24+ }
25+ }
26+
1127pub fn inb ( port : u16 ) -> u8 {
1228 let mut input_byte: u8 ;
1329 unsafe {
@@ -17,3 +33,23 @@ pub fn inb(port: u16) -> u8 {
1733 }
1834 input_byte
1935}
36+
37+ pub fn inw ( port : u16 ) -> u16 {
38+ let mut input_byte: u16 ;
39+ unsafe {
40+ asm ! ( "in ax, dx" ,
41+ in( "dx" ) port,
42+ out( "ax" ) input_byte) ;
43+ }
44+ input_byte
45+ }
46+
47+ pub fn inl ( port : u16 ) -> u32 {
48+ let mut input_byte: u32 ;
49+ unsafe {
50+ asm ! ( "in eax, dx" ,
51+ in( "dx" ) port,
52+ out( "eax" ) input_byte) ;
53+ }
54+ input_byte
55+ }
You can’t perform that action at this time.
0 commit comments