Lines 1-15
Link Here
|
1 |
--- test.c.orig 2013-08-10 02:29:44 UTC |
1 |
--- test.c.orig 2020-05-02 07:40:33.395621000 +0000 |
2 |
+++ test.c |
2 |
+++ test.c 2020-05-02 07:43:36.559375000 +0000 |
3 |
@@ -14,7 +14,6 @@ |
3 |
@@ -14,7 +14,6 @@ |
4 |
#include "stdint.h" |
4 |
#include "stdint.h" |
5 |
#include "cpuid.h" |
5 |
#include "cpuid.h" |
6 |
#include "smp.h" |
6 |
#include "smp.h" |
7 |
-#include <sys/io.h> |
7 |
-#include "io.h" |
8 |
|
8 |
|
9 |
extern struct cpu_ident cpu_id; |
9 |
extern struct cpu_ident cpu_id; |
10 |
extern volatile int mstr_cpu; |
10 |
extern volatile int mstr_cpu; |
11 |
@@ -1543,6 +1542,19 @@ void sleep(long n, int flag, int me, int |
11 |
@@ -1521,6 +1520,19 @@ |
12 |
} |
12 |
} |
13 |
} |
13 |
} |
14 |
|
14 |
|
15 |
+static inline unsigned char inb(unsigned int port) |
15 |
+static inline unsigned char inb(unsigned int port) |
Lines 25-53
Link Here
|
25 |
+ asm __volatile__("outb %0,%1" : : "a" (data), "id" ((unsigned short)(port))); |
25 |
+ asm __volatile__("outb %0,%1" : : "a" (data), "id" ((unsigned short)(port))); |
26 |
+} |
26 |
+} |
27 |
+ |
27 |
+ |
28 |
/* Beep function */ |
|
|
29 |
|
30 |
void beep(unsigned int frequency) |
28 |
void beep(unsigned int frequency) |
31 |
@@ -1551,18 +1563,18 @@ void beep(unsigned int frequency) |
29 |
{ |
32 |
unsigned int count = 1193180 / frequency; |
30 |
#if 0 |
|
|
31 |
@@ -1531,19 +1543,19 @@ |
32 |
unsigned int count = 1193180 / frequency; |
33 |
|
33 |
|
34 |
// Switch on the speaker |
34 |
// Switch on the speaker |
35 |
- outb_p(inb_p(0x61)|3, 0x61); |
35 |
- outb_p(inb_p(0x61)|3, 0x61); |
36 |
+ outb(inb(0x61)|3, 0x61); |
36 |
+ outb(inb(0x61)|3, 0x61); |
37 |
|
37 |
|
38 |
// Set command for counter 2, 2 byte write |
38 |
// Set command for counter 2, 2 byte write |
39 |
- outb_p(0xB6, 0x43); |
39 |
- outb_p(0xB6, 0x43); |
40 |
+ outb(0xB6, 0x43); |
40 |
+ outb(0xB6, 0x43); |
41 |
|
41 |
|
42 |
// Select desired Hz |
42 |
// Select desired Hz |
43 |
- outb_p(count & 0xff, 0x42); |
43 |
- outb_p(count & 0xff, 0x42); |
44 |
+ outb(count & 0xff, 0x42); |
44 |
+ outb(count & 0xff, 0x42); |
45 |
outb((count >> 8) & 0xff, 0x42); |
45 |
outb((count >> 8) & 0xff, 0x42); |
46 |
|
46 |
|
47 |
// Block for 100 microseconds |
47 |
// Block for 100 microseconds |
48 |
sleep(100, 0, 0, 1); |
48 |
sleep(100, 0, 0, 1); |
49 |
|
49 |
|
50 |
// Switch off the speaker |
50 |
// Switch off the speaker |
51 |
- outb(inb_p(0x61)&0xFC, 0x61); |
51 |
- outb(inb_p(0x61)&0xFC, 0x61); |
52 |
+ outb(inb(0x61)&0xFC, 0x61); |
52 |
+ outb(inb(0x61)&0xFC, 0x61); |
|
|
53 |
#endif |
53 |
} |
54 |
} |