xref: /haiku/src/add-ons/kernel/drivers/audio/cmedia/cmedia_pci.h (revision a9ea5be764e78e1ddb41a2a6f09d6ee7b8a41acd)
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 #define DRIVER_NAME "cmedia"
29 
30 typedef struct joystick cmedia_pci_joystick;
31 
32 
33 typedef struct audio_format cmedia_pci_audio_format;
34 typedef struct audio_buf_header cmedia_pci_audio_buf_header;
35 
36 
37 /* the mux devices use these records */
38 typedef audio_routing cmedia_pci_routing;
39 
40 /* this is the argument for ioctl() */
41 typedef audio_routing_cmd cmedia_pci_routing_cmd;
42 
43 
44 /* selectors for routing */
45 #define CMEDIA_PCI_INPUT_MUX				B_AUDIO_INPUT_SELECT
46 #define CMEDIA_PCI_MIC_BOOST				B_AUDIO_MIC_BOOST
47 #define CMEDIA_PCI_MIDI_OUTPUT_TO_SYNTH	B_AUDIO_MIDI_OUTPUT_TO_SYNTH
48 #define CMEDIA_PCI_MIDI_INPUT_TO_SYNTH		B_AUDIO_MIDI_INPUT_TO_SYNTH
49 #define CMEDIA_PCI_MIDI_OUTPUT_TO_PORT		B_AUDIO_MIDI_OUTPUT_TO_PORT
50 
51 /* input MUX source values */
52 #define CMEDIA_PCI_INPUT_CD				B_AUDIO_INPUT_CD
53 #define CMEDIA_PCI_INPUT_DAC				B_AUDIO_INPUT_DAC
54 #define CMEDIA_PCI_INPUT_AUX2				B_AUDIO_INPUT_AUX2
55 #define CMEDIA_PCI_INPUT_LINE				B_AUDIO_INPUT_LINE_IN
56 #define CMEDIA_PCI_INPUT_AUX1				B_AUDIO_INPUT_AUX1
57 #define CMEDIA_PCI_INPUT_MIC				B_AUDIO_INPUT_MIC
58 #define CMEDIA_PCI_INPUT_MIX_OUT			B_AUDIO_INPUT_MIX_OUT
59 
60 
61 /* the mixer devices use these records */
62 typedef audio_level cmedia_pci_level;
63 
64 /* this is the arg to ioctl() */
65 typedef audio_level_cmd cmedia_pci_level_cmd;
66 
67 /* bitmask for the flags */
68 #define CMEDIA_PCI_LEVEL_MUTED				B_AUDIO_LEVEL_MUTED
69 
70 /* selectors for levels */
71 #define CMEDIA_PCI_LEFT_ADC_INPUT_G		B_AUDIO_MIX_ADC_LEFT
72 #define CMEDIA_PCI_RIGHT_ADC_INPUT_G 		B_AUDIO_MIX_ADC_RIGHT
73 #define CMEDIA_PCI_LEFT_AUX1_LOOPBACK_GAM	B_AUDIO_MIX_VIDEO_LEFT
74 #define CMEDIA_PCI_RIGHT_AUX1_LOOPBACK_GAM	B_AUDIO_MIX_VIDEO_RIGHT
75 #define CMEDIA_PCI_LEFT_CD_LOOPBACK_GAM	B_AUDIO_MIX_CD_LEFT
76 #define CMEDIA_PCI_RIGHT_CD_LOOPBACK_GAM	B_AUDIO_MIX_CD_RIGHT
77 #define CMEDIA_PCI_LEFT_LINE_LOOPBACK_GAM	B_AUDIO_MIX_LINE_IN_LEFT
78 #define CMEDIA_PCI_RIGHT_LINE_LOOPBACK_GAM	B_AUDIO_MIX_LINE_IN_RIGHT
79 #define CMEDIA_PCI_MIC_LOOPBACK_GAM		B_AUDIO_MIX_MIC
80 #define CMEDIA_PCI_LEFT_SYNTH_OUTPUT_GAM	B_AUDIO_MIX_SYNTH_LEFT
81 #define CMEDIA_PCI_RIGHT_SYNTH_OUTPUT_GAM	B_AUDIO_MIX_SYNTH_RIGHT
82 #define CMEDIA_PCI_LEFT_AUX2_LOOPBACK_GAM	B_AUDIO_MIX_AUX_LEFT
83 #define CMEDIA_PCI_RIGHT_AUX2_LOOPBACK_GAM	B_AUDIO_MIX_AUX_RIGHT
84 #define CMEDIA_PCI_LEFT_MASTER_VOLUME_AM	B_AUDIO_MIX_LINE_OUT_LEFT
85 #define CMEDIA_PCI_RIGHT_MASTER_VOLUME_AM	B_AUDIO_MIX_LINE_OUT_RIGHT
86 #define CMEDIA_PCI_LEFT_PCM_OUTPUT_GAM		B_AUDIO_MIX_DAC_LEFT
87 #define CMEDIA_PCI_RIGHT_PCM_OUTPUT_GAM	B_AUDIO_MIX_DAC_RIGHT
88 #define CMEDIA_PCI_DIGITAL_LOOPBACK_AM		B_AUDIO_MIX_LOOPBACK_LEVEL
89 
90 
91 /* secret handshake ioctl()s */
92 #define SV_SECRET_HANDSHAKE 10100
93 typedef struct {
94 	bigtime_t	wr_time;
95 	bigtime_t	rd_time;
96 	uint32		wr_skipped;
97 	uint32		rd_skipped;
98 	uint64		wr_total;
99 	uint64		rd_total;
100 	uint32		_reserved_[6];
101 } sv_handshake;
102 #define SV_RD_TIME_WAIT 10101
103 #define SV_WR_TIME_WAIT 10102
104 typedef struct {
105 	bigtime_t	time;
106 	bigtime_t	bytes;
107 	uint32		skipped;
108 	uint32		_reserved_[3];
109 } sv_timing;
110 
111 
112 
113 #endif	/* _CMEDIA_PCI_H */
114 
115