Warning, cross-references for /kernel/include/drivers/sb16/sound.h need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef __SOUND_H__
0019 #define __SOUND_H__
0020
0021
0022 #define SB_OK 0
0023 #define SB_RESET_DSP 1
0024 #define SB_DETECT_DSP 2
0025 #define SB_NOT_INITIALIZED 3
0026 #define SB_INVALID_IRQ 4
0027 #define SB_INVALID_DMA 5
0028 #define SB_SAMPLE_RATE 6
0029 #define SB_TOO_MANY_VOICES 7
0030 #define SB_USE_STEREO 8
0031 #define SB_INVALID_FILE 9
0032
0033
0034 #define SB_DSP_RESET 0x06
0035 #define SB_DSP_READ_DATA 0x0A
0036 #define SB_DSP_WRITE 0x0C
0037 #define SB_DSP_WRITE_BUFFER_STATUS 0x0C
0038 #define SB_DSP_READ_BUFFER_STATUS 0x0E
0039
0040 #define INTERRUPT_SETUP 0x80
0041 #define DMA_SETUP 0x81
0042
0043
0044 #define SB_RESET_TIMEOUT 5000000
0045 #define SB_IRQ_DETECT_TIMEOUT 5000000
0046 #define SB_HIGH_SPEED_FREQUENCY 23 * 1024
0047 #define SB_MEMORY_SIZE 4096
0048 #define SB_MAX_VOICES 8
0049 #define WAV_CHUNK_LENGTH 12
0050 #define SB_DRIVER_VERSION_HI 0x01
0051 #define SB_DRIVER_VERSION_LO 0x05
0052
0053
0054 #define MIXER_REG_ADDR_PORT 0x04
0055 #define MIXER_DATA_PORT 0x05
0056 #define MIXER_RESET 0x00
0057 #define MIXER_OUTPUT 0x0E
0058
0059
0060 #define SB_EXTENSION_RAW ".RAW"
0061 #define SB_EXTENSION_WAV ".WAV"
0062
0063
0064
0065 #define SB_SPEAKER_ON 0xD1
0066 #define SB_SPEAKER_OFF 0xD3
0067 #define SB_DSP_VERSION 0xE1
0068 #define SB_DMA_MODE_8_SC 0x14
0069 #define SB_DMA_MODE_8_AI_NS 0x1C
0070 #define SB_TIME_CONSTANT 0x40
0071 #define SB_DMA_BLOCK_SIZE 0x48
0072 #define SB_DMA_MODE_8_AI_HS 0x90
0073 #define SB_HALT_DMA 0xD0
0074 #define SB_EXIT_DMA 0xDA
0075 #define SB_IRQ_TRIGGER 0xF2
0076
0077
0078 #define SB_PIC1_EOI 0x20
0079 #define SB_PIC2_EOI 0xA0
0080 #define SB_PIC_MASK_1 0x21
0081 #define SB_PIC_MASK_2 0xA1
0082
0083
0084 #define SB_IRQ_ACK_8 0x0E
0085 #define SB_IRQ_ACK_16 0x0F
0086
0087
0088 #define SB_DMA_MASK_8 0x0A
0089 #define SB_DMA_MODE_8 0x0B
0090 #define SB_DMA_CLEAR_8 0x0C
0091 #define SB_DMA_MASK_16 0xD4
0092 #define SB_DMA_MODE_16 0xD6
0093 #define SB_DMA_CLEAR_16 0xD8
0094
0095 typedef struct
0096 {
0097 char riffsign[4] ;
0098 int length PACKED;
0099 char wavesign[4] ;
0100 char ftmsign[4] ;
0101 int formatlength PACKED;
0102 uint16 waveformat PACKED;
0103 uint16 channels PACKED;
0104 uint16 samplespersec PACKED;
0105 uint16 averagebytes PACKED;
0106 uint16 blockalign PACKED;
0107 uint16 formatspecific PACKED;
0108 } WAVCHUNK;
0109
0110 typedef struct
0111 {
0112 char sign[4] ;
0113 int length PACKED;
0114 } DATACHUNK;
0115
0116
0117 typedef struct
0118 {
0119 uint16 min_mono_8;
0120 uint16 max_mono_8;
0121 uint16 min_stereo_8;
0122 uint16 max_stereo_8;
0123 uint16 min_mono_16;
0124 uint16 max_mono_16;
0125 uint16 min_stereo_16;
0126 uint16 max_stereo_16;
0127 bool auto_dma;
0128 bool stereo;
0129 bool _16_bit;
0130 } SB_CAPABILITY;
0131
0132
0133
0134 PRIVATE SB_CAPABILITY capability_sb_10 = {
0135 min_mono_8:4000,
0136 max_mono_8:22222,
0137 min_stereo_8:0,
0138 max_stereo_8:0,
0139 min_mono_16:0,
0140 max_mono_16:0,
0141 min_stereo_16:0,
0142 max_stereo_16:0,
0143 auto_dma:FALSE,
0144 stereo:FALSE,
0145 _16_bit:FALSE
0146 };
0147
0148
0149 PRIVATE SB_CAPABILITY capability_sb_20 = {
0150 min_mono_8:4000,
0151 max_mono_8:45454,
0152 min_stereo_8:0,
0153 max_stereo_8:0,
0154 min_mono_16:0,
0155 max_mono_16:0,
0156 min_stereo_16:0,
0157 max_stereo_16:0,
0158 auto_dma:TRUE,
0159 stereo:FALSE,
0160 _16_bit:FALSE
0161 };
0162
0163
0164 PRIVATE SB_CAPABILITY capability_sb_pro = {
0165 min_mono_8:4000,
0166 max_mono_8:45454,
0167 min_stereo_8:4000,
0168 max_stereo_8:22727,
0169 min_mono_16:0,
0170 max_mono_16:0,
0171 min_stereo_16:0,
0172 max_stereo_16:0,
0173 auto_dma:TRUE,
0174 stereo:TRUE,
0175 _16_bit:FALSE
0176 };
0177
0178
0179 PRIVATE SB_CAPABILITY capability_sb_16 = {
0180 min_mono_8:4000,
0181 max_mono_8:45454,
0182 min_stereo_8:4000,
0183 max_stereo_8:45454,
0184 min_mono_16:4000,
0185 max_mono_16:45454,
0186 min_stereo_16:4000,
0187 max_stereo_16:45454,
0188 auto_dma:TRUE,
0189 stereo:TRUE,
0190 _16_bit:TRUE
0191 };
0192
0193
0194 PRIVATE SB_CAPABILITY capability_sb_awe32 = {
0195 min_mono_8:5000,
0196 max_mono_8:45454,
0197 min_stereo_8:5000,
0198 max_stereo_8:45454,
0199 min_mono_16:5000,
0200 max_mono_16:45454,
0201 min_stereo_16:5000,
0202 max_stereo_16:45454,
0203 auto_dma:TRUE,
0204 stereo:TRUE,
0205 _16_bit:TRUE
0206 };
0207
0208 #define SAMPLE_uint8 uint8
0209 #define SAMPLE_CLIP_MIN 0
0210 #define SAMPLE_CLIP_MAX 255
0211
0212 typedef struct
0213 {
0214 int size;
0215 SAMPLE_uint8 *data;
0216 bool stereo;
0217 } SAMPLE;
0218
0219 bool sb_dsp_reset (uint16 base_address);
0220 bool sb_dsp_write (uint8 value);
0221 bool sb_dsp_read (uint8 * value);
0222 bool sb_speaker_on (void);
0223 bool sb_speaker_off (void);
0224 bool sb_dsp_get_version (uint16 * version);
0225 bool sb_get_model_name (char *name);
0226 bool sb_dsp_detect_base_address (uint16 * base_address);
0227 bool sb_dsp_detect_irq_number (uint16 base_address, uint8 * irq_number);
0228 bool sb_dsp_detect_dma (uint16 base_address, uint8 * dma8, uint8 * dma16);
0229 bool sb_play_sample (SAMPLE * sample);
0230 bool sb_mixer_register_set (uint8 index, uint8 value);
0231 bool sb_mixer_register_get (uint8 index, uint8 * value);
0232 bool sb_install_driver (uint16 frequency, bool use_stereo);
0233
0234 #endif
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245