1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
/**
* @ingroup io68_lib
* @file io68/mwemul.h
* @author Benjamin Gerard
* @date 1999/03/20
* @brief STE sound emulator header.
*
*/
/* $Id: mwemul.h 127 2009-09-14 02:51:23Z benjihan $ */
/* Copyright (C) 1998-2009 Benjamin Gerard */
/**
* @defgroup io68_lib_mw STE sound emulator
* @ingroup io68_lib
* @brief STE (MicroWire/LMC/DMA) emulator.
*
* @{
*/
/** Micro-Wire registers. */
;
/** Microwire/LMC mixer modes. */
;
/** Microwire emulator engines. */
;
/** Microwire sampling rate is given in hertz (hz). */
;
/** LMC register values are mostly unsigned bytes. */
;
/** Microwire configuration parameters. */
typedef struct mw_parms_t;
/** Microwire setup structure. */
typedef struct mw_setup_t;
/** Type used by internal counters.
*
* This type must be an unsigned of at least 32-bit. Values are
* always fixed point. The amount of shifting is calculated so that
* the most useful bit is the most signifiant bit. Therefore these
* counters get an automatic natural modulo.
*/
typedef uint68_t mwct_t;
/** Microwire emulator instance. */
typedef struct mw_t;
static inline
mwct_t
static inline
void
/** @name Microwire emulator functions
* @{
*/
/** Microwire emulator setup.
*
* The mw_init() function must be call before any other
* function. It mainly setups internal tables.
*
* @return error-code
* @retval 0 on success
* @retval -1 on error (should never happen)
*
* @see mw_shutdown()
*/
int ;
/** Microwire emulator shutdown.
*
* @see mw_init()
*/
void ;
/** Setup microwire instance.
*
* @param mw microwire instance
* @param setup setup configuration
* @return error status
* @retval 0 on success
* @retval -1 on error
*/
int ;
/** Cleanup microwire instance. */
void ;
/** Set/Get microwire sampling rate.
*
* The mw_sampling_rate() function set microwire emulator sampling
* rate.
*
* @param mw microwire instance (0 for set or get library default)
* @param hz @ref mw_hz_e "sampling rate"
* @return @ref mw_hz_e "sampling rate"
*/
int ;
/** Set/Get microwire emulator engine.
* @param mw microwire instance (0 for set or get library default)
* @param engine @ref mw_engine_e "engine descriptor"
* @return @ref mw_engine_e "engine descriptor"
*/
int ;
/** Microwire reset.
*
* The mw_reset() reset function restore the chip on to its default
* configuation or what it is believed to be.
*
* @param mw microwire instance
* @return error status (always success)
* @retval 0 on success
* @retval -1 on error
*/
int ;
/** Execute microwire emulation.
*
* The mw_mix() function processes sample mixing with current internal
* parameters for n samples. Mixed samples are stored in a large enough
* (at least n) 32 bit buffer pointed by b. This buffer have to be
* previously filled with the YM-2149 samples. Typically it is the YM-2149
* emulator output buffer. This allows Microwire emulator to honnor the
* LMC mixer mode.iven LMC mode. This porocess include the mono to stereo
* expansion. The mem68 starting pointer locates the 68K memory buffer
* where samples are stored to allow DMA fetch emulation.
*
* @param out Pointer to YM-2149 source sample directly used for
* Microwire output mixing.
* @param mem68 Pointer to 68K memory buffer start address
* @param n Number of sample to mix in out buffer
*
* @see YM_mix() @see YM_get_buffer()
*/
void ;
/** @} */
/** @name Microwire LMC functions
* @{
*/
/** Set/Get LMC mixer mode.
*
* The mw_lmc_mixer() function selects or retrieves the function
* used by the chip to blend the YM-2149 signal and the digital
* signal produce by microwire chip.
*
* @param mw microwire instance
* @param mode @ref mw_mixer_e "mixer mode"
* @return @ref mw_mixer_e "mixer mode"
*/
int ;
/** Set/Get LMC master volume.
*
* @param mw microwire instance
* @param n @ref mw_lmc_e "volume" in range [0..40] for [-80..0] dB
* @return master @ref mw_lmc_e "volume"
*
* @see mw_lmc_left()
* @see mw_lmc_right()
*/
int ;
/** Set/Get LMC left channel volume.
*
* @param mw microwire instance
* @param n @ref mw_lmc_e "volume" in range [0..20] for [-40..0] dB
* @return left @ref mw_lmc_e "volume"
*
* @see mw_lmc_master()
* @see mw_lmc_right()
*/
int ;
/** Set/Get LMC right channel volume.
*
* @param mw microwire instance
* @param n @ref mw_lmc_e "volume" in range [0..20] for [-40..0] dB
* @return right @ref mw_lmc_e "volume"
*
* @see mw_lmc_master()
* @see mw_lmc_left()
*/
int ;
/** Set/Get high pass filter.
*
* @param mw microwire instance
* @param n @mw_lmc_e "high pass filter" in range [0..12] for [-12..0] dB
* @return @mw_lmc_e "high pass filter"
*
* @see mw_lmc_low()
* @warning Filters are not supported by this microwire emulator.
*/
int ;
/** Set/Get low pass filter.
*
* @param mw microwire instance
* @param n @mw_lmc_e "low pass filter" in range [0..12] for [-12..0] dB
* @return @mw_lmc_e "low pass filter"
*
* @see mw_lmc_high()
* @warning Filters are not supported by this microwire emulator.
*/
int ;
/** Parse and execute a microwire command.
*
* @param mw microwire instance
* @retval 0 on success (a command was found)
* @retval -1 on error
*
*/
int ;
/** @} */
/**
* @}
*/
/* #ifndef _MWEMUL_H_*/