diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ppc/8xx_io/cs4218.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/ppc/8xx_io/cs4218.h')
-rw-r--r-- | arch/ppc/8xx_io/cs4218.h | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/arch/ppc/8xx_io/cs4218.h b/arch/ppc/8xx_io/cs4218.h new file mode 100644 index 000000000000..a3c38c5a5db2 --- /dev/null +++ b/arch/ppc/8xx_io/cs4218.h | |||
@@ -0,0 +1,167 @@ | |||
1 | #ifndef _cs4218_h_ | ||
2 | /* | ||
3 | * Hacked version of linux/drivers/sound/dmasound/dmasound.h | ||
4 | * | ||
5 | * | ||
6 | * Minor numbers for the sound driver. | ||
7 | * | ||
8 | * Unfortunately Creative called the codec chip of SB as a DSP. For this | ||
9 | * reason the /dev/dsp is reserved for digitized audio use. There is a | ||
10 | * device for true DSP processors but it will be called something else. | ||
11 | * In v3.0 it's /dev/sndproc but this could be a temporary solution. | ||
12 | */ | ||
13 | #define _cs4218_h_ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/config.h> | ||
17 | |||
18 | #define SND_NDEVS 256 /* Number of supported devices */ | ||
19 | #define SND_DEV_CTL 0 /* Control port /dev/mixer */ | ||
20 | #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM | ||
21 | synthesizer and MIDI output) */ | ||
22 | #define SND_DEV_MIDIN 2 /* Raw midi access */ | ||
23 | #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ | ||
24 | #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ | ||
25 | #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ | ||
26 | #define SND_DEV_STATUS 6 /* /dev/sndstat */ | ||
27 | /* #7 not in use now. Was in 2.4. Free for use after v3.0. */ | ||
28 | #define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */ | ||
29 | #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */ | ||
30 | #define SND_DEV_PSS SND_DEV_SNDPROC | ||
31 | |||
32 | /* switch on various prinks */ | ||
33 | #define DEBUG_DMASOUND 1 | ||
34 | |||
35 | #define MAX_AUDIO_DEV 5 | ||
36 | #define MAX_MIXER_DEV 4 | ||
37 | #define MAX_SYNTH_DEV 3 | ||
38 | #define MAX_MIDI_DEV 6 | ||
39 | #define MAX_TIMER_DEV 3 | ||
40 | |||
41 | #define MAX_CATCH_RADIUS 10 | ||
42 | |||
43 | #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff)) | ||
44 | #define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff)) | ||
45 | |||
46 | #define IOCTL_IN(arg, ret) \ | ||
47 | do { int error = get_user(ret, (int *)(arg)); \ | ||
48 | if (error) return error; \ | ||
49 | } while (0) | ||
50 | #define IOCTL_OUT(arg, ret) ioctl_return((int *)(arg), ret) | ||
51 | |||
52 | static inline int ioctl_return(int *addr, int value) | ||
53 | { | ||
54 | return value < 0 ? value : put_user(value, addr); | ||
55 | } | ||
56 | |||
57 | #define HAS_RECORD | ||
58 | |||
59 | /* | ||
60 | * Initialization | ||
61 | */ | ||
62 | |||
63 | /* description of the set-up applies to either hard or soft settings */ | ||
64 | |||
65 | typedef struct { | ||
66 | int format; /* AFMT_* */ | ||
67 | int stereo; /* 0 = mono, 1 = stereo */ | ||
68 | int size; /* 8/16 bit*/ | ||
69 | int speed; /* speed */ | ||
70 | } SETTINGS; | ||
71 | |||
72 | /* | ||
73 | * Machine definitions | ||
74 | */ | ||
75 | |||
76 | typedef struct { | ||
77 | const char *name; | ||
78 | const char *name2; | ||
79 | void (*open)(void); | ||
80 | void (*release)(void); | ||
81 | void *(*dma_alloc)(unsigned int, int); | ||
82 | void (*dma_free)(void *, unsigned int); | ||
83 | int (*irqinit)(void); | ||
84 | #ifdef MODULE | ||
85 | void (*irqcleanup)(void); | ||
86 | #endif | ||
87 | void (*init)(void); | ||
88 | void (*silence)(void); | ||
89 | int (*setFormat)(int); | ||
90 | int (*setVolume)(int); | ||
91 | int (*setBass)(int); | ||
92 | int (*setTreble)(int); | ||
93 | int (*setGain)(int); | ||
94 | void (*play)(void); | ||
95 | void (*record)(void); /* optional */ | ||
96 | void (*mixer_init)(void); /* optional */ | ||
97 | int (*mixer_ioctl)(u_int, u_long); /* optional */ | ||
98 | int (*write_sq_setup)(void); /* optional */ | ||
99 | int (*read_sq_setup)(void); /* optional */ | ||
100 | int (*sq_open)(mode_t); /* optional */ | ||
101 | int (*state_info)(char *, size_t); /* optional */ | ||
102 | void (*abort_read)(void); /* optional */ | ||
103 | int min_dsp_speed; | ||
104 | int max_dsp_speed; | ||
105 | int version ; | ||
106 | int hardware_afmts ; /* OSS says we only return h'ware info */ | ||
107 | /* when queried via SNDCTL_DSP_GETFMTS */ | ||
108 | int capabilities ; /* low-level reply to SNDCTL_DSP_GETCAPS */ | ||
109 | SETTINGS default_hard ; /* open() or init() should set something valid */ | ||
110 | SETTINGS default_soft ; /* you can make it look like old OSS, if you want to */ | ||
111 | } MACHINE; | ||
112 | |||
113 | /* | ||
114 | * Low level stuff | ||
115 | */ | ||
116 | |||
117 | typedef struct { | ||
118 | ssize_t (*ct_ulaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
119 | ssize_t (*ct_alaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
120 | ssize_t (*ct_s8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
121 | ssize_t (*ct_u8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
122 | ssize_t (*ct_s16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
123 | ssize_t (*ct_u16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
124 | ssize_t (*ct_s16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
125 | ssize_t (*ct_u16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); | ||
126 | } TRANS; | ||
127 | |||
128 | |||
129 | /* | ||
130 | * Sound queue stuff, the heart of the driver | ||
131 | */ | ||
132 | |||
133 | struct sound_queue { | ||
134 | /* buffers allocated for this queue */ | ||
135 | int numBufs; /* real limits on what the user can have */ | ||
136 | int bufSize; /* in bytes */ | ||
137 | char **buffers; | ||
138 | |||
139 | /* current parameters */ | ||
140 | int locked ; /* params cannot be modified when != 0 */ | ||
141 | int user_frags ; /* user requests this many */ | ||
142 | int user_frag_size ; /* of this size */ | ||
143 | int max_count; /* actual # fragments <= numBufs */ | ||
144 | int block_size; /* internal block size in bytes */ | ||
145 | int max_active; /* in-use fragments <= max_count */ | ||
146 | |||
147 | /* it shouldn't be necessary to declare any of these volatile */ | ||
148 | int front, rear, count; | ||
149 | int rear_size; | ||
150 | /* | ||
151 | * The use of the playing field depends on the hardware | ||
152 | * | ||
153 | * Atari, PMac: The number of frames that are loaded/playing | ||
154 | * | ||
155 | * Amiga: Bit 0 is set: a frame is loaded | ||
156 | * Bit 1 is set: a frame is playing | ||
157 | */ | ||
158 | int active; | ||
159 | wait_queue_head_t action_queue, open_queue, sync_queue; | ||
160 | int open_mode; | ||
161 | int busy, syncing, xruns, died; | ||
162 | }; | ||
163 | |||
164 | #define SLEEP(queue) interruptible_sleep_on_timeout(&queue, HZ) | ||
165 | #define WAKE_UP(queue) (wake_up_interruptible(&queue)) | ||
166 | |||
167 | #endif /* _cs4218_h_ */ | ||