59 lines
1.4 KiB
Text
59 lines
1.4 KiB
Text
$NetBSD: patch-ab,v 1.1 2006/10/24 18:00:06 smb Exp $
|
|
|
|
--- test.c.orig 2005-09-11 14:17:15.000000000 -0400
|
|
+++ test.c 2006-10-21 15:35:25.000000000 -0400
|
|
@@ -11,7 +11,29 @@
|
|
|
|
#include "test.h"
|
|
#include "config.h"
|
|
-#include <sys/io.h>
|
|
+
|
|
+static __inline void
|
|
+pkg_outb (unsigned char value, unsigned short int port)
|
|
+{
|
|
+ __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port));
|
|
+}
|
|
+
|
|
+static __inline void
|
|
+pkg_outb_p (unsigned char value, unsigned short int port)
|
|
+{
|
|
+ __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (value),
|
|
+ "Nd" (port));
|
|
+}
|
|
+
|
|
+static __inline unsigned char
|
|
+pkg_inb_p (unsigned short int port)
|
|
+{
|
|
+ unsigned char _v;
|
|
+
|
|
+ __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (port));
|
|
+ return _v;
|
|
+}
|
|
+
|
|
|
|
|
|
extern int segs, bail, beepmode;
|
|
@@ -1741,18 +1763,18 @@
|
|
unsigned int count = 1193180 / frequency;
|
|
|
|
// Switch on the speaker
|
|
- outb_p(inb_p(0x61)|3, 0x61);
|
|
+ pkg_outb_p(pkg_inb_p(0x61)|3, 0x61);
|
|
|
|
// Set command for counter 2, 2 byte write
|
|
- outb_p(0xB6, 0x43);
|
|
+ pkg_outb_p(0xB6, 0x43);
|
|
|
|
// Select desired Hz
|
|
- outb_p(count & 0xff, 0x42);
|
|
- outb((count >> 8) & 0xff, 0x42);
|
|
+ pkg_outb_p(count & 0xff, 0x42);
|
|
+ pkg_outb((count >> 8) & 0xff, 0x42);
|
|
|
|
// Block for 100 microseconds
|
|
sleep(100, 1);
|
|
|
|
// Switch off the speaker
|
|
- outb(inb_p(0x61)&0xFC, 0x61);
|
|
+ pkg_outb(pkg_inb_p(0x61)&0xFC, 0x61);
|
|
}
|