xref: /minix3/minix/drivers/audio/trident/trident.h (revision eecf6d233de53b7d1fcaf6fbe895fee40cef7299)
1 #ifndef _SDR_H
2 #define _SDR_H
3 /* ======= General Parameter ======= */
4 /* Global configure */
5 #define DMA_LENGTH_BY_FRAME
6 #define MIXER_AC97
7 
8 #include <minix/audio_fw.h>
9 #include <sys/types.h>
10 #include <sys/ioc_sound.h>
11 #include <minix/sound.h>
12 #include <machine/pci.h>
13 #include <sys/mman.h>
14 #include "io.h"
15 
16 /* Subdevice type */
17 #define DAC		0
18 #define ADC		1
19 #define MIX		2
20 
21 /* PCI number and driver name */
22 #define VENDOR_ID		0x1023
23 #define DEVICE_ID		0x2000
24 #define DRIVER_NAME		"Trident"
25 
26 /* Volume option */
27 #define GET_VOL			0
28 #define SET_VOL			1
29 
30 /* Interrupt control */
31 #define INTR_ENABLE		1
32 #define INTR_DISABLE	0
33 
34 /* Interrupt status */
35 #define INTR_STS_DAC		0x0020
36 #define INTR_STS_ADC		0x0004
37 
38 /* ======= Self-defined Parameter ======= */
39 #define REG_DMA0			0x00
40 #define REG_DMA4			0x04
41 #define REG_DMA6			0x06
42 #define REG_DMA11			0x0b
43 #define REG_DMA15			0x0f
44 #define REG_CODEC_WRITE		0x40
45 #define REG_CODEC_READ		0x44
46 #define REG_CODEC_CTRL		0x48
47 #define REG_GCTRL			0xa0
48 #define REG_SB_DELTA		0xac
49 #define REG_SB_BASE			0xc0
50 #define REG_SB_CTRL			0xc4
51 #define REG_CHAN_BASE		0xe0
52 #define REG_INTR_STS		0xb0
53 
54 #define REG_START_A			0x80
55 #define REG_STOP_A			0x84
56 #define REG_CSPF_A			0x90
57 #define REG_ADDR_INT_A		0x98
58 #define REG_INTR_CTRL_A		0xa4
59 #define REG_START_B			0xb4
60 #define REG_STOP_B			0xb8
61 #define REG_CSPF_B			0xbc
62 #define REG_ADDR_INT_B		0xd8
63 #define REG_INTR_CTRL_B		0xdc
64 
65 #define STS_CODEC_BUSY	0x8000
66 
67 #define CMD_FORMAT_BIT16	0x08
68 #define CMD_FORMAT_SIGN		0x02
69 #define CMD_FORMAT_STEREO	0x04
70 
71 typedef struct channel_info {
72 	u32_t cso, alpha, fms, fmc, ec;
73 	u32_t dma, eso, delta, bufhalf, index;
74 	u32_t rvol, cvol, gvsel, pan, vol, ctrl;
75 } channel_info;
76 static channel_info my_chan;
77 
78 /* Driver Data Structure */
79 typedef struct aud_sub_dev_conf_t {
80 	u32_t stereo;
81 	u16_t sample_rate;
82 	u32_t nr_of_bits;
83 	u32_t sign;
84 	u32_t busy;
85 	u32_t fragment_size;
86 	u8_t format;
87 } aud_sub_dev_conf_t;
88 
89 typedef struct DEV_STRUCT {
90 	char *name;
91 	u16_t vid;
92 	u16_t did;
93 	u32_t devind;
94 	u32_t base[6];
95 	char irq;
96 	char revision;
97 	u32_t intr_status;
98 } DEV_STRUCT;
99 
100 void dev_mixer_write(u32_t *base, u32_t reg, u32_t val);
101 u32_t dev_mixer_read(u32_t *base, u32_t reg);
102 
103 #endif
104