xref: /haiku/src/add-ons/kernel/drivers/audio/cmedia/cmedia_pci.h (revision 93a78ecaa45114d68952d08c4778f073515102f2)
1 /* cmedia_pci.h -- specifics for S3-based PCI audio cards */
2 /* $Id: cmedia_pci.h,v 1.3 1999/10/13 02:29:19 cltien Exp $ */
3 /*
4 	Copyright 1999, Be Incorporated.   All Rights Reserved.
5 	This file may be used under the terms of the Be Sample Code License.
6 */
7 
8 #if !defined(_CMEDIA_PCI_H)
9 #define _CMEDIA_PCI_H
10 
11 #include <Drivers.h>
12 #include <SupportDefs.h>
13 #include <OS.h>
14 #include "audio_driver.h"
15 #include "midi_driver.h"
16 #include "joystick_driver.h"
17 
18 
19 #define CMEDIA_PCI_VENDOR_ID	0x13F6	/* C-Media Inc	*/
20 #define CMEDIA_8338A_DEVICE_ID	0x0100	/* CM8338A		*/
21 #define CMEDIA_8338B_DEVICE_ID	0x0101	/* CM8338B		*/
22 #define CMEDIA_8738A_DEVICE_ID	0x0111	/* CM8738A		*/
23 #define CMEDIA_8738B_DEVICE_ID	0x0112	/* CM8738B		*/
24 
25 #define CMEDIA_PCI_JOYSTICK_MIN_LATENCY 5000		/* 200 times a second! */
26 #define CMEDIA_PCI_JOYSTICK_MAX_LATENCY 100000		/* 10 times a second */
27 
28 typedef struct joystick cmedia_pci_joystick;
29 
30 
31 typedef struct audio_format cmedia_pci_audio_format;
32 typedef struct audio_buf_header cmedia_pci_audio_buf_header;
33 
34 
35 /* the mux devices use these records */
36 typedef audio_routing cmedia_pci_routing;
37 
38 /* this is the argument for ioctl() */
39 typedef audio_routing_cmd cmedia_pci_routing_cmd;
40 
41 
42 /* selectors for routing */
43 #define CMEDIA_PCI_INPUT_MUX				B_AUDIO_INPUT_SELECT
44 #define CMEDIA_PCI_MIC_BOOST				B_AUDIO_MIC_BOOST
45 #define CMEDIA_PCI_MIDI_OUTPUT_TO_SYNTH	B_AUDIO_MIDI_OUTPUT_TO_SYNTH
46 #define CMEDIA_PCI_MIDI_INPUT_TO_SYNTH		B_AUDIO_MIDI_INPUT_TO_SYNTH
47 #define CMEDIA_PCI_MIDI_OUTPUT_TO_PORT		B_AUDIO_MIDI_OUTPUT_TO_PORT
48 
49 /* input MUX source values */
50 #define CMEDIA_PCI_INPUT_CD				B_AUDIO_INPUT_CD
51 #define CMEDIA_PCI_INPUT_DAC				B_AUDIO_INPUT_DAC
52 #define CMEDIA_PCI_INPUT_AUX2				B_AUDIO_INPUT_AUX2
53 #define CMEDIA_PCI_INPUT_LINE				B_AUDIO_INPUT_LINE_IN
54 #define CMEDIA_PCI_INPUT_AUX1				B_AUDIO_INPUT_AUX1
55 #define CMEDIA_PCI_INPUT_MIC				B_AUDIO_INPUT_MIC
56 #define CMEDIA_PCI_INPUT_MIX_OUT			B_AUDIO_INPUT_MIX_OUT
57 
58 
59 /* the mixer devices use these records */
60 typedef audio_level cmedia_pci_level;
61 
62 /* this is the arg to ioctl() */
63 typedef audio_level_cmd cmedia_pci_level_cmd;
64 
65 /* bitmask for the flags */
66 #define CMEDIA_PCI_LEVEL_MUTED				B_AUDIO_LEVEL_MUTED
67 
68 /* selectors for levels */
69 #define CMEDIA_PCI_LEFT_ADC_INPUT_G		B_AUDIO_MIX_ADC_LEFT
70 #define CMEDIA_PCI_RIGHT_ADC_INPUT_G 		B_AUDIO_MIX_ADC_RIGHT
71 #define CMEDIA_PCI_LEFT_AUX1_LOOPBACK_GAM	B_AUDIO_MIX_VIDEO_LEFT
72 #define CMEDIA_PCI_RIGHT_AUX1_LOOPBACK_GAM	B_AUDIO_MIX_VIDEO_RIGHT
73 #define CMEDIA_PCI_LEFT_CD_LOOPBACK_GAM	B_AUDIO_MIX_CD_LEFT
74 #define CMEDIA_PCI_RIGHT_CD_LOOPBACK_GAM	B_AUDIO_MIX_CD_RIGHT
75 #define CMEDIA_PCI_LEFT_LINE_LOOPBACK_GAM	B_AUDIO_MIX_LINE_IN_LEFT
76 #define CMEDIA_PCI_RIGHT_LINE_LOOPBACK_GAM	B_AUDIO_MIX_LINE_IN_RIGHT
77 #define CMEDIA_PCI_MIC_LOOPBACK_GAM		B_AUDIO_MIX_MIC
78 #define CMEDIA_PCI_LEFT_SYNTH_OUTPUT_GAM	B_AUDIO_MIX_SYNTH_LEFT
79 #define CMEDIA_PCI_RIGHT_SYNTH_OUTPUT_GAM	B_AUDIO_MIX_SYNTH_RIGHT
80 #define CMEDIA_PCI_LEFT_AUX2_LOOPBACK_GAM	B_AUDIO_MIX_AUX_LEFT
81 #define CMEDIA_PCI_RIGHT_AUX2_LOOPBACK_GAM	B_AUDIO_MIX_AUX_RIGHT
82 #define CMEDIA_PCI_LEFT_MASTER_VOLUME_AM	B_AUDIO_MIX_LINE_OUT_LEFT
83 #define CMEDIA_PCI_RIGHT_MASTER_VOLUME_AM	B_AUDIO_MIX_LINE_OUT_RIGHT
84 #define CMEDIA_PCI_LEFT_PCM_OUTPUT_GAM		B_AUDIO_MIX_DAC_LEFT
85 #define CMEDIA_PCI_RIGHT_PCM_OUTPUT_GAM	B_AUDIO_MIX_DAC_RIGHT
86 #define CMEDIA_PCI_DIGITAL_LOOPBACK_AM		B_AUDIO_MIX_LOOPBACK_LEVEL
87 
88 
89 /* secret handshake ioctl()s */
90 #define SV_SECRET_HANDSHAKE 10100
91 typedef struct {
92 	bigtime_t	wr_time;
93 	bigtime_t	rd_time;
94 	uint32		wr_skipped;
95 	uint32		rd_skipped;
96 	uint64		wr_total;
97 	uint64		rd_total;
98 	uint32		_reserved_[6];
99 } sv_handshake;
100 #define SV_RD_TIME_WAIT 10101
101 #define SV_WR_TIME_WAIT 10102
102 typedef struct {
103 	bigtime_t	time;
104 	bigtime_t	bytes;
105 	uint32		skipped;
106 	uint32		_reserved_[3];
107 } sv_timing;
108 
109 
110 
111 #endif	/* _CMEDIA_PCI_H */
112 
113