ReactOS  0.4.14-dev-376-gaedba84
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
83  NTSTATUS ret;
84 
85  DPRINT1("SoundBlaster 16 Driver 0.0.1\n");
87  {
88  DPRINT1("Soundblaster 16 not found\n");
89  return 0;
90  }
92  if (ret!=STATUS_SUCCESS)
93  return(ret);
94 
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 
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
void get_dma(SB16 *sb16)
Definition: mixer.c:38
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
sb_status reset_dsp(unsigned short base_address)
Definition: dsp.c:56
LONG NTSTATUS
Definition: precomp.h:26
Definition: wave.h:5
unsigned char sb_status
Definition: dsp.h:11
#define SB_TRUE
Definition: dsp.h:1
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define SB_FALSE
Definition: dsp.h:2
SB16 sb16
Definition: sound.c:26
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
unsigned char irq
Definition: sb16.h:4
#define FILE_DEVICE_WAVE_OUT
Definition: winioctl.h:143
void sb16_play(WAVE_HDR *wave)
Definition: wave.c:39
unsigned char dma16
Definition: sb16.h:6
int ret
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
sb_status sb16_getenvironment(void)
Definition: sound.c:106
unsigned char get_irq(SB16 *sb16)
Definition: mixer.c:26
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
Definition: wsk.h:182
sb_status detect_dsp(SB16 *sb16)
Definition: dsp.c:38
unsigned char dma8
Definition: sb16.h:5
Definition: sb16.h:1
#define DPRINT1
Definition: precomp.h:8
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
unsigned short base
Definition: sb16.h:3
#define IO_NO_INCREMENT
Definition: iotypes.h:566
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
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97