|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1994 NeXT Computer, Inc. All rights reserved. ! 3: * ! 4: * HISTORY ! 5: * 4-Mar-94 Rakesh Dubey at NeXT ! 6: * Created. ! 7: */ ! 8: ! 9: /* ! 10: * The default base address is 0x220. Adresses depend upon the flavor of ! 11: * sound card and are not software selectable. ! 12: */ ! 13: ! 14: /* ! 15: * SB 1.5 and earlier : 16 bytes at 0x210 to 0x260 ! 16: * SB 2.0 : 16 bytes at 0x220 and 0x240 ! 17: * SB Pro : 24 bytes at 0x220 and 0x240 ! 18: */ ! 19: #define SB_BASE_ADDRESS_1 0x0210 ! 20: #define SB_BASE_ADDRESS_2 0x0220 ! 21: #define SB_BASE_ADDRESS_3 0x0230 ! 22: #define SB_BASE_ADDRESS_4 0x0240 ! 23: #define SB_BASE_ADDRESS_5 0x0250 ! 24: #define SB_BASE_ADDRESS_6 0x0260 ! 25: ! 26: /* ! 27: * DSP register offsets. ! 28: */ ! 29: #define SB_DSP_RESET_OFFSET 0x06 /* write only */ ! 30: #define SB_DSP_READ_DATA_OFFSET 0x0a /* read only */ ! 31: #define SB_DSP_WRITE_DATA_OR_COMMAND_OFFSET 0x0c /* write */ ! 32: ! 33: ! 34: /* ! 35: * These two indicate whether the DSP is busy and whether the result is ! 36: * available from DSP (if any). Success is indicated by bit 7 of the ! 37: * appropriate register getting set and reset respectively. ! 38: */ ! 39: #define SB_DSP_WRITE_BUFFER_STATUS_OFFSET 0x0c /* read */ ! 40: #define SB_DSP_DATA_AVAILABLE_STATUS_OFFSET 0x0e /* read only */ ! 41: ! 42: /* ! 43: * DSP Command list. SB SDK advises to wait for 3.3us after an address write ! 44: * and 23us after a data write. ! 45: */ ! 46: ! 47: #define SB_ADDRESS_WRITE_DELAY 10 ! 48: #define SB_DATA_WRITE_DELAY 25 ! 49: #define SB_DATA_READ_DELAY 10 ! 50: ! 51: /* ! 52: * Set the sampling rate. There are many limitations depending upon the ! 53: * flavor of card and transfer mode. ! 54: */ ! 55: #define DC_SET_TIME_CONSTANT 0x40 ! 56: ! 57: /* ! 58: * Speaker control. Speaker must be off while doing input. ! 59: */ ! 60: #define DC_TURN_ON_SPEAKER 0xd1 ! 61: #define DC_TURN_OFF_SPEAKER 0xd3 ! 62: #define DC_GET_SPEAKER_STATUS 0xd8 ! 63: ! 64: /* ! 65: * Request low speed DMA transfer. ! 66: */ ! 67: #define DC_START_LS_DMA_DAC_8 0x14 ! 68: #define DC_START_LS_DMA_ADC_8 0x24 ! 69: ! 70: /* ! 71: * Request high speed DMA transfer. ! 72: */ ! 73: #define DC_SET_BLOCK_SIZE 0x48 ! 74: ! 75: #define DC_START_HS_DMA_DAC_8 0x91 ! 76: #define DC_START_HS_DMA_ADC_8 0x99 ! 77: ! 78: /* ! 79: * DSP side other DMA control commands. ! 80: */ ! 81: #define DC_HALT_DMA 0xd0 ! 82: ! 83: /* ! 84: * Not used. ! 85: */ ! 86: #define DC_CONTINUE_DMA 0xd4 ! 87: #define DC_SEND_SILENCE 0x80 ! 88: #define DC_PIO_ADC_8 0x20 /* Programmed I/O */ ! 89: #define DC_PIO_DAC_8 0x10 ! 90: ! 91: /* ! 92: * Other transfer modes for output. Currently unsupported. ! 93: */ ! 94: #define DC_START_LS_DMA_DAC_2 0x16 ! 95: #define DC_START_LS_DMA_DAC_2_6 0x76 ! 96: #define DC_START_LS_DMA_DAC_4 0x74 ! 97: ! 98: /* ! 99: * Other miscelleaneous DSP Coomands. ! 100: */ ! 101: #define DC_GET_VERSION 0xe1 ! 102: #define DC_INVERT_BYTE 0xe0 ! 103: ! 104: /* ! 105: * Record mode control (available only for SBPro) ! 106: */ ! 107: #define DC_RECORD_IN_MONO 0xa0 ! 108: #define DC_RECORD_IN_STEREO 0xa8 ! 109: ! 110: /* ! 111: * Note: Mixer is available in SB Pro model only. ! 112: */ ! 113: ! 114: /* ! 115: * Mixer register offsets. ! 116: */ ! 117: #define SB_MIXER_ADDRESS_OFFSET 0x04 ! 118: #define SB_MIXER_DATA_OFFSET 0x05 ! 119: ! 120: /* ! 121: * Mixer Commands for setting volume. ! 122: */ ! 123: #define MC_MASTER_VOLUME 0x22 ! 124: #define MC_FM_VOLUME 0x26 ! 125: #define MC_CD_VOLUME 0x28 ! 126: #define MC_LINE_VOLUME 0x2e ! 127: #define MC_VOC_VOLUME 0x04 ! 128: #define MC_MICROPHONE_VOLUME 0x0a ! 129: ! 130: /* ! 131: * Other mixer commands for selecting input output type. ! 132: */ ! 133: #define MC_RECORD_CONTROL 0x0c ! 134: #define MC_PLAYBACK_CONTROL 0x0e ! 135: ! 136: /* ! 137: * Actually you have only half as many settings. ! 138: */ ! 139: #define MAX_INPUT_GAIN_LINE 0x0f ! 140: #define MAX_INPUT_GAIN_MICROPHONE 0x07 ! 141: ! 142: #define MAX_MASTER_OUTPUT_VOLUME 0x0f ! 143: #define MAX_FM_OUTPUT_VOLUME 0x0f ! 144: #define MAX_LINE_OUTPUT_VOLUME 0x0f ! 145: #define MAX_CD_OUTPUT_VOLUME 0x0f ! 146: ! 147: #define MUTE_OUTPUT 1 ! 148: #define UNMUTE_OUTPUT 0 ! 149: ! 150: #define PLAYBACK_ENABLE 1 ! 151: #define PLAYBACK_DISABLE 0 ! 152: #define CAPTURE_ENABLE 1 ! 153: #define CAPTURE_DISABLE 0 ! 154: ! 155: #define ENABLE_DMA_PLAYBACK 0 ! 156: #define ENABLE_DMA_CAPTURE 0 ! 157: #define DISABLE_DMA_PLAYBACK 1 ! 158: #define DISABLE_DMA_CAPTURE 1 ! 159: ! 160: #define DSP_DATA_LINEAR 0 ! 161: #define DSP_DATA_COMPANDED 1 ! 162: ! 163: /* ! 164: * After these sampling rates we must use the high speed part of the DSP (and ! 165: * use different commands). ! 166: */ ! 167: #define SB_CLASSIC_MAX_SPEED_RECORD 13000 ! 168: #define SB_CLASSIC_MAX_SPEED_PLAYBACK 23000 ! 169: ! 170: #define SB_20_LOW_SPEED_RECORD 15000 ! 171: #define SB_20_LOW_SPEED_PLAYBACK 23000 ! 172: ! 173: #define SB_PRO_LOW_SPEED 23000 ! 174: ! 175: /* ! 176: * Maximum and minimum sampling rates. ! 177: */ ! 178: #define SB_MAX_SAMPLE_RATE 47619 ! 179: #define SB_MIN_SAMPLE_RATE 3906 ! 180: ! 181: #define DSP_MONO_MODE 0 ! 182: #define DSP_STEREO_MODE 1 ! 183: ! 184: #define LEFT_CHANNEL 0 ! 185: #define RIGHT_CHANNEL 1 ! 186: ! 187: #define LINE_LEVEL_INPUT 0 ! 188: #define MICROPHONE_LEVEL_INPUT 1 ! 189: ! 190: #define DMA_DIRECTION_IN 0 ! 191: #define DMA_DIRECTION_OUT 1 ! 192: ! 193: /* ! 194: * Typedefs for SB Mono and stereo mixer registers. ! 195: */ ! 196: typedef unsigned char sbMonoMixerRegister_t; ! 197: ! 198: typedef union { ! 199: struct { ! 200: unsigned char ! 201: right:4, ! 202: left:4; ! 203: } reg; ! 204: unsigned char data; ! 205: } sbStereoMixerRegister_t; ! 206: ! 207: /* ! 208: * This list will grow bigger, if we decide to take advantages of different ! 209: * cards in each of these two classes. That will be a pain though. ObS: Why ! 210: * do we have to call old things classic? ! 211: */ ! 212: typedef enum { ! 213: SB_CLASSIC = 1, SB_20, SB_PRO, SB_16, SB_NONE ! 214: } sbCardVersion_t; ! 215: ! 216: typedef struct { ! 217: sbCardVersion_t version; ! 218: char *name; ! 219: unsigned int majorVersion; ! 220: unsigned int minorVersion; ! 221: BOOL mixerPresent; ! 222: } sbCardParameters_t; ! 223: ! 224: ! 225: /* ! 226: * Shadow registers for recording. Available only for SB Pro model. ! 227: */ ! 228: #define SB_RECORD_SOURCE_MIC 0 ! 229: #define SB_RECORD_SOURCE_CD 1 ! 230: #define SB_RECORD_SOURCE_LINE 2 ! 231: ! 232: #define SB_RECORD_FREQ_HIGH 1 ! 233: #define SB_RECORD_FREQ_LOW 0 ! 234: ! 235: #define SB_RECORD_ANFI_ON 1 ! 236: #define SB_RECORD_ANFI_OFF 0 ! 237: ! 238: typedef union { ! 239: struct { ! 240: unsigned char ! 241: rsvd1:1, /* bit 0 */ ! 242: source:2, ! 243: highFreq:1, ! 244: rsvd2:1, ! 245: inputFilter:1, ! 246: rsvd3:2; /* bit 7 */ ! 247: } reg; ! 248: unsigned char data; ! 249: } sbRecordingMode_t; ! 250: ! 251: /* ! 252: * For playback. ! 253: */ ! 254: #define SB_PLAYBACK_STEREO 1 ! 255: #define SB_PLAYBACK_MONO 0 ! 256: ! 257: #define SB_PLAYBACK_DNFI_ON 1 ! 258: #define SB_PLAYBACK_DNFI_OFF 0 ! 259: ! 260: typedef union { ! 261: struct { ! 262: unsigned char ! 263: rsvd1:1, ! 264: stereo:1, ! 265: rsvd2:3, ! 266: outputFilter:1, ! 267: rsvd3:2; ! 268: } reg; ! 269: unsigned char data; ! 270: } sbPlaybackMode_t; ! 271:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.