Indentation fix, cleanup.
[AROS.git] / arch / i386-pc / include / asm / speaker.h
blob0dbc896e4c3dcd7a022459fd9d49aca7528a4589
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef _SPEAKER_H
7 #define _SPEAKER_H
9 #define inb(port) \
10 ({ char __value; \
11 __asm__ __volatile__ ("inb $" #port ",%%al":"=a"(__value)); \
12 __value; })
14 #define outb(val,port) \
15 ({ char __value=(val); \
16 __asm__ __volatile__ ("outb %%al,$" #port::"a"(__value)); })
19 #define SetSpkFreq(freq) \
20 do \
21 { \
22 WORD counter = 0x1234DD / freq; \
23 outb (0xB6, 0x43); \
24 outb ((UBYTE) (counter & 0x00FF), 0x42); \
25 outb ((UBYTE) ((counter & 0xFF00) >> 8), 0x42); \
26 } \
27 while (0)
29 #define SpkOn() outb (inb(0x61) | 3, 0x61)
31 #define SpkOff() outb (inb(0x61) & ~3, 0x61)
33 #define Sound(freq,loop) \
34 SetSpkFreq(freq); \
35 SpkOn(); \
36 { \
37 int i, dummy; \
38 for (i = 0; i < loop; dummy = i*i, i++);\
39 } \
40 SpkOff();
42 #endif /* _SPEAKER_H */