ReactOS  0.4.15-dev-1070-ge1a01de
beep.c
Go to the documentation of this file.
1 /*
2  * PROJECT: NEC PC-98 series HAL
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Speaker support (beeping)
5  * COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
6  */
7 
8 /* INCLUDES ******************************************************************/
9 
10 #include <hal.h>
11 
12 #define NDEBUG
13 #include <debug.h>
14 
15 /* FUNCTIONS *****************************************************************/
16 
17 BOOLEAN
18 NTAPI
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 }
BOOLEAN NTAPI HalMakeBeep(IN ULONG Frequency)
Definition: beep.c:22
#define TRUE
Definition: types.h:120
#define FIRSTBYTE(VALUE)
Definition: rtlfuncs.h:795
#define PPI_TIMER_1_UNGATE_TO_SPEAKER
Definition: sysport.h:14
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:244
unsigned char BOOLEAN
#define TIMER_CONTROL_PORT
Definition: halp.h:22
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:227
#define PPI_IO_o_CONTROL
Definition: sysport.h:12
#define TIMER_CHANNEL1_DATA_PORT
Definition: halhw.h:68
#define _In_
Definition: no_sal2.h:204
ULONG PIT_FREQUENCY
Definition: clock.c:17
static LARGE_INTEGER Frequency
Definition: clock.c:41
unsigned int ULONG
Definition: retypes.h:1
#define PPI_TIMER_1_GATE_TO_SPEAKER
Definition: sysport.h:13
#define SECONDBYTE(VALUE)
Definition: rtlfuncs.h:796