ReactOS 0.4.16-dev-297-gc569aee
sound.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: mkernel/modules/sound/sound.c
5 * PURPOSE: SoundBlaster 16 Driver
6 * PROGRAMMER: Snatched from David Welch (welch@mcmail.com)
7 * Modified for Soundblaster by Robert Bergkvist (fragdance@hotmail.com)
8 * UPDATE HISTORY:
9 * ??/??/??: Created
10 *
11 */
12
13/* FUNCTIONS **************************************************************/
14
15#include <ntddk.h>
16#include <string.h>
17#include <devices.h>
18#include "sb16.h"
19#include "dsp.h"
20#include "mixer.h"
21#include "wave.h"
22
23#define NDEBUG
24#include <debug.h>
25
28
29#if 0
31/*
32 * FUNCTION: Handles user mode requests
33 * ARGUMENTS:
34 * DeviceObject = Device for request
35 * Irp = I/O request packet describing request
36 * RETURNS: Success or failure
37 */
38{
41
42 switch (Stack->MajorFunction)
43 {
44 case IRP_MJ_CREATE:
45 DPRINT1("(SoundBlaster 16 Driver WaveOut) Creating\n");
48 break;
49
50 case IRP_MJ_CLOSE:
52 break;
53
54 case IRP_MJ_WRITE:
55 DPRINT1("(SoundBlaster 16 Driver) Writing %d bytes\n",Stack->Parameters.Write.Length);
56 sb16_play((WAVE_HDR*)Irp->UserBuffer);
58 break;
59
60 default:
62 break;
63 }
64
65 Irp->IoStatus.Status = status;
66 Irp->IoStatus.Information = 0;
67
69 return(status);
70}
71
73/*
74 * FUNCTION: Called by the system to initialize the driver
75 * ARGUMENTS:
76 * DriverObject = object describing this driver
77 * RegistryPath = path to our configuration entries
78 * RETURNS: Success or failure
79 */
80{
81#if 0
84
85 DPRINT1("SoundBlaster 16 Driver 0.0.1\n");
87 {
88 DPRINT1("Soundblaster 16 not found\n");
89 return 0;
90 }
93 return(ret);
94
95 DeviceObject->Flags=0;
96 DriverObject->MajorFunction[IRP_MJ_CLOSE] = Dispatch;
97 DriverObject->MajorFunction[IRP_MJ_CREATE] =Dispatch;
98 DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
99 DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
100 DriverObject->DriverUnload = NULL;
101#endif
102 return(STATUS_SUCCESS);
103}
104#endif
105
107{
108 if(detect_dsp(&sb16)!=SB_TRUE)
109 {
110 DPRINT1("Detect DSP failed!!!\n");
111 return SB_FALSE;
112 }
113 DPRINT1("DSP base address 0x%x\n",sb16.base);
114 get_irq(&sb16);
115 DPRINT1("IRQ: %d\n",sb16.irq);
116 get_dma(&sb16);
117 DPRINT1("DMA8: 0x%x DMA16: 0x%x\n",sb16.dma8,sb16.dma16);
118 return SB_TRUE;
119}
120
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
void get_dma(SB16 *sb16)
Definition: mixer.c:38
unsigned char get_irq(SB16 *sb16)
Definition: mixer.c:26
sb_status sb16_getenvironment(void)
Definition: sound.c:106
SB16 sb16
Definition: sound.c:26
void sb16_play(WAVE_HDR *wave)
Definition: wave.c:39
sb_status reset_dsp(unsigned short base_address)
Definition: dsp.c:56
sb_status detect_dsp(SB16 *sb16)
Definition: dsp.c:38
#define SB_FALSE
Definition: dsp.h:2
unsigned char sb_status
Definition: dsp.h:11
#define SB_TRUE
Definition: dsp.h:1
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define IoCompleteRequest
Definition: irp.c:1240
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_WAVE_OUT
Definition: winioctl.h:83
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: sb16.h:2
unsigned char dma16
Definition: sb16.h:6
unsigned char irq
Definition: sb16.h:4
unsigned short base
Definition: sb16.h:3
unsigned char dma8
Definition: sb16.h:5
Definition: wave.h:6
Definition: ps.c:97
#define NTAPI
Definition: typedefs.h:36
int ret
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
Definition: wsk.h:188
#define IO_NO_INCREMENT
Definition: iotypes.h:598