ReactOS 0.4.16-dev-197-g92996da
beep.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for beep.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOLEAN NTAPI HalMakeBeep (_In_ ULONG Frequency)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file beep.c.

Function Documentation

◆ HalMakeBeep()

BOOLEAN NTAPI HalMakeBeep ( _In_ ULONG  Frequency)

Definition at line 19 of file beep.c.

21{
22 TIMER_CONTROL_PORT_REGISTER TimerControl;
23 ULONG Divider;
25
27
29
30 if (Frequency)
31 {
32 Divider = PIT_FREQUENCY / Frequency;
33
34 if (Divider <= 0x10000)
35 {
36 TimerControl.BcdMode = FALSE;
37 TimerControl.OperatingMode = PitOperatingMode3;
38 TimerControl.Channel = PitChannel1;
39 TimerControl.AccessMode = PitAccessModeLowHigh;
40 __outbyte(TIMER_CONTROL_PORT, TimerControl.Bits);
43
45
46 Success = TRUE;
47 }
48 }
49
51
52 return Success;
53}
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ Success
Definition: eventcreate.c:712
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:243
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:226
#define PIT_FREQUENCY
Definition: halhw.h:61
@ PitChannel1
Definition: halhw.h:103
#define TIMER_CONTROL_PORT
Definition: halhw.h:70
@ PitAccessModeLowHigh
Definition: halhw.h:97
#define TIMER_CHANNEL1_DATA_PORT
Definition: halhw.h:68
@ PitOperatingMode3
Definition: halhw.h:85
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
static LARGE_INTEGER Frequency
Definition: clock.c:41
#define PPI_IO_o_CONTROL
Definition: sysport.h:12
#define PPI_TIMER_1_UNGATE_TO_SPEAKER
Definition: sysport.h:14
#define PPI_TIMER_1_GATE_TO_SPEAKER
Definition: sysport.h:13
uint32_t ULONG
Definition: typedefs.h:59
#define SECONDBYTE(VALUE)
Definition: rtlfuncs.h:804
#define FIRSTBYTE(VALUE)
Definition: rtlfuncs.h:803