|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * AWACs - Audio Waveform Amplifier and Converter ! 24: * ! 25: * Notes: ! 26: * ! 27: * 1. All values written to (or read from) hardware must be endian reversed ! 28: * when using the constants from this file. ! 29: * 2. The hardware uses a serial-bus time multiplexed scheme to communicate ! 30: * with up to four addressable devices (subframes). AWACs currently only uses ! 31: * 'SubFrame 0'. When a register field refers to a subframe, then the SubFrame0 ! 32: * value should be used. ! 33: * 3. The CodecControlRegister is used to as a pointer/data reg to access four 12-bit ! 34: * registers. The kCodecCtlAddress* values indicate the 12-bit register to be ! 35: * written and the kCodecCtlDataMask indicates the 12-bits to be written. ! 36: * kCodecCtlBusy is set/cleared by hardware when a pending value waiting to be ! 37: * written to one of the 12-bit registers. kCodecCtlEMSelect* indicates which ! 38: * SubFrame the data will go out on. (See Note 2) ! 39: * 4. The SoundControlRegister is used to set the data rate and indicates the input, ! 40: * output and status subframes. (See Note 2). ! 41: * 5. The CodecStatusRegister indicate when there was an error, or a change of input ! 42: * or output sources, i.e. a mic, line, or headphones were plugged in. ! 43: * 6. The ClippingCountRegister is incremented on a left/right channel overflow. It ! 44: * is reset by reading its contents. ! 45: * ! 46: */ ! 47: ! 48: /*----------------------------- AWACs register mapping structure -------------------------*/ ! 49: ! 50: struct awacs_regmap_t ! 51: { ! 52: volatile u_int32_t SoundControlRegister; ! 53: u_int32_t pad0[3]; ! 54: volatile u_int32_t CodecControlRegister; ! 55: u_int32_t pad1[3]; ! 56: volatile u_int32_t CodecStatusRegister; ! 57: u_int32_t pad2[3]; ! 58: volatile u_int32_t ClippingCountRegister; ! 59: u_int32_t pad3[3]; ! 60: volatile u_int32_t ByteSwappingRegister; ! 61: }; ! 62: ! 63: ! 64: /*------------------------ AWACs CODEC Control register constants -----------------------*/ ! 65: ! 66: enum AWACsCODEC_ControlRegisterGeneralConstants ! 67: { ! 68: kCodecCtlDataMask = 0x00000FFF, /*CODEC control data bits*/ ! 69: ! 70: kCodecCtlAddress0 = 0x00000000, /*Select address 0*/ ! 71: kCodecCtlAddress1 = 0x00001000, /*Select address 1*/ ! 72: kCodecCtlAddress2 = 0x00002000, /*Select address 2*/ ! 73: kCodecCtlAddress4 = 0x00004000, /*Select address 4*/ ! 74: kCodecCtlAddress5 = 0x00005000, /*Select address 5 - Screamer only */ ! 75: kCodecCtlAddress6 = 0x00006000, /*Select address 6 - Screamer only */ ! 76: kCodecCtlAddress7 = 0x00007000, /*Select address 7 - Screamer only */ ! 77: ! 78: kCodecCtlEMSelect0 = 0x00000000, /*Select subframe 0*/ ! 79: kCodecCtlEMSelect1 = 0x00400000, /*Select subframe 1*/ ! 80: kCodecCtlEMSelect2 = 0x00800000, /*Select subframe 2*/ ! 81: kCodecCtlEMSelect4 = 0x00C00000, /*Select subframe 4*/ ! 82: ! 83: kCodecCtlBusy = 0x01000000 /*AWACS busy bit */ ! 84: }; ! 85: ! 86: enum AWACsCODEC_ControlRegister0Constants ! 87: { ! 88: kLeftInputGainMask = 0x000000F0, /*Bits used for left input gain*/ ! 89: kLeftInputGainShift = 4, ! 90: kRightInputGainMask = 0x0000000F, /*Bits used for right input gain*/ ! 91: kRightInputGainShift = 0, ! 92: ! 93: kDefaultMicGain = 0x000000CC, /*Default right & left gain for a mic*/ ! 94: kDefaultCDGain = 0x000000BB, /*Default right & left gain for a CD*/ ! 95: ! 96: kNotMicPreamp = 0x00000100, /*Select preamp on or off*/ ! 97: ! 98: kInputMuxMask = 0x00000E00, /*Bits used to set which input to use */ ! 99: kCDInput = 0x00000200, /*Bit 9 = CD ROM audio input*/ ! 100: kMicInput = 0x00000400, /*Bit 10 = external mic input*/ ! 101: kUnusedInput = 0x00000800, /*Bit 11 = unused input*/ ! 102: kInitialAwacsR0Value = 0x00000000 /*Initial value set on boot*/ ! 103: }; ! 104: ! 105: ! 106: enum AWACsCODEC_ControlRegister1Constants ! 107: { ! 108: kReservedR1Bit0 = 0x00000001, /*Reserved - always set to zero*/ ! 109: kReservedR1Bit1 = 0x00000002, /*Reserved - always set to zero*/ ! 110: kRecalibrate = 0x00000004, /*Recalibrate AWACs*/ ! 111: kExtraSampleRateMask = 0x00000038, /*!!!Do these bits do anything???*/ ! 112: kLoopThruEnable = 0x00000040, /*Loop thru enable*/ ! 113: kMuteInternalSpeaker = 0x00000080, /*Internal speaker mute*/ ! 114: kReservedR1Bit8 = 0x00000100, /*Reserved - always set to zero*/ ! 115: kMuteHeadphone = 0x00000200, /*Headphone mute*/ ! 116: kOutputZero = 0x00000400, ! 117: kOutputOne = 0x00000800, /*Sometimes speaker enable*/ ! 118: kParallelOutputEnable = 0x00000C00, /*Parallel output port*/ ! 119: kInitialAwacsR1Value = 0x00000000 /*Initial value set on boot*/ ! 120: }; ! 121: ! 122: ! 123: enum AWACsCODEC_ControlRegister2Constants ! 124: { ! 125: kRightHeadphoneAttenMask = 0x0000000F, /*Attenuation for right headphone speaker*/ ! 126: kRightHeadphoneAttenShift = 0, /*Bit shift from LSB position*/ ! 127: kReservedR2Bit4 = 0x00000010, /*Reserved - always set to zero*/ ! 128: kReservedR2Bit5 = 0x00000020, /*Reserved - always set to zero*/ ! 129: kLeftHeadphoneAttenMask = 0x000003C0, /*Attenuation for left headphone speaker*/ ! 130: kLeftHeadphoneAttenShift = 6, /*Bit shift from LSB position*/ ! 131: kReservedR2Bit10 = 0x00000400, /*Reserved - always set to zero*/ ! 132: kReservedR2Bit11 = 0x00000800, /*Reserved - always set to zero*/ ! 133: kHeadphoneAttenMask = (kRightHeadphoneAttenMask | kLeftHeadphoneAttenMask), ! 134: kInitialAwacsR2Value = 0x00000000 /*Initial value set on boot*/ ! 135: }; ! 136: ! 137: ! 138: enum AWACsCODEC_ControlRegister4Constants ! 139: { ! 140: kRightSpeakerAttenMask = 0x0000000F, /*Attenuation for right internal speaker*/ ! 141: kRightSpeakerAttenShift = 0, /*Bit shift from LSB position*/ ! 142: kReservedR4Bit4 = 0x00000010, /*Reserved - always set to zero*/ ! 143: kReservedR4Bit5 = 0x00000020, /*Reserved - always set to zero*/ ! 144: kLeftSpeakerAttenMask = 0x000003C0, /*Attenuation for left internal speaker*/ ! 145: kLeftSpeakerAttenShift = 6, /*Bit shift from LSB position*/ ! 146: kReservedR4Bit10 = 0x00000400, /*Reserved - always set to zero*/ ! 147: kReservedR4Bit11 = 0x00000800, /*Reserved - always set to zero*/ ! 148: kSpeakerAttenMask = (kRightSpeakerAttenMask | kLeftSpeakerAttenMask), ! 149: kInitialAwacsR4Value = 0x00000000 /*Initial value set on boot*/ ! 150: }; ! 151: ! 152: /*---------------------- Screamer Extensions ----------------------------------------*/ ! 153: ! 154: enum AWACsVersions ! 155: { ! 156: kAWACSMaxVersion = 2 ! 157: }; ! 158: ! 159: enum AWACsCODEC_ControlRegister5Constants ! 160: { ! 161: kRightLoopThruAttenMask = 0x0000000F, ! 162: kRightLoopThruAttenShift = 0, ! 163: kLeftLoopThruAttenMask = 0x000003C0, ! 164: kLeftLoopThruAttenShift = 6 ! 165: }; ! 166: ! 167: enum AWACsCODEC_ControlRegister6Constants ! 168: { ! 169: kPowerModeDoze = 0x00000001, ! 170: kPowerModeIdle = 0x00000002, ! 171: kMicPreampBoostEnable = 0x00000004, ! 172: kPCMCIASpeakerAttenMask = 0x00000038, ! 173: kPowerModeAnalogShutdown = 0x00000040, ! 174: kLittleDischarge = 0x00000080, ! 175: kBigDischarge = 0x00000100 ! 176: }; ! 177: ! 178: enum AWACsCODEC_ControlRegister7Constants ! 179: { ! 180: kReadBackEnable = 0x00000001, ! 181: kReadBackRegisterMask = 0x0000000E, ! 182: kReadBackRegisterShift = 1 ! 183: }; ! 184: ! 185: /*----------------- AWACs CODEC Status Register constants -------------------------------*/ ! 186: ! 187: enum AWACsCODEC_StatusRegisterConstants ! 188: { ! 189: kNotMicSense = 0x00000001, /*This bit is 0 when a mic(input) is plugged in*/ ! 190: kNotMicShift = 0, ! 191: kLineInSense = 0x00000002, /*This bit is 1, when a line(input) is pluggen in*/ ! 192: kLineInShft = 1, ! 193: kAux1Sense = 0x00000004, /*This bit is 1, when something is plugged into the Whisper line-out */ ! 194: kAux1Shft = 2, ! 195: kHeadphoneSense = 0x00000008, /*This bit is 1 when headphone is plugged in*/ ! 196: kHeadphoneShft = 3, ! 197: kAllSense = 0x0000000F, ! 198: kManufacturerIDMask = 0x00000F00, /*AWACS chip manufacturer ID bits*/ ! 199: kManufacturerIDShft = 8, /*Bits to shift right to get ID in LSB position*/ ! 200: kRevisionNumberMask = 0x0000F000, /*AWACS chip revision bits*/ ! 201: kRevisionNumberShft = 12, /*Bits to shift right to get rev in LSB position*/ ! 202: kAwacsErrorStatus = 0x000F0000, /*AWACS error status bits*/ ! 203: kOverflowRight = 0x00100000, ! 204: kOverflowLeft = 0x00200000, ! 205: kValidData = 0x00400000, ! 206: kExtend = 0x00800000 ! 207: }; ! 208: ! 209: /*--------------------- AWACs Sound Control register ------------------------------------*/ ! 210: ! 211: enum AWACsSoundControlRegisterConstants ! 212: { ! 213: kInSubFrameMask = 0x0000000F, /*All of the input subframe bits*/ ! 214: kInSubFrame0 = 0x00000001, /*Input subframe 0*/ ! 215: kInSubFrame1 = 0x00000002, /*Input subframe 1*/ ! 216: kInSubFrame2 = 0x00000004, /*Input subframe 2*/ ! 217: kInSubFrame3 = 0x00000008, /*Input subframe 3*/ ! 218: ! 219: kOutSubFrameMask = 0x000000F0, /*All of the output subframe bits*/ ! 220: kOutSubFrame0 = 0x00000010, /*Output subframe 0*/ ! 221: kOutSubFrame1 = 0x00000020, /*Output subframe 1*/ ! 222: kOutSubFrame2 = 0x00000040, /*Output subframe 2*/ ! 223: kOutSubFrame3 = 0x00000080, /*Output subframe 3*/ ! 224: ! 225: kHWRateMask = 0x00000700, /*All of the hardware sampling rate bits*/ ! 226: kHWRate44100 = 0x00000000, /*Hardware sampling bits for 44100 Hz*/ ! 227: kHWRate29400 = 0x00000100, /*Hardware sampling bits for 29400 Hz*/ ! 228: kHWRate22050 = 0x00000200, /*Hardware sampling bits for 22050 Hz*/ ! 229: kHWRate17640 = 0x00000300, /*Hardware sampling bits for 17640 Hz*/ ! 230: kHWRate14700 = 0x00000400, /*Hardware sampling bits for 14700 Hz*/ ! 231: kHWRate11025 = 0x00000500, /*Hardware sampling bits for 11025 Hz*/ ! 232: kHWRate08820 = 0x00000600, /*Hardware sampling bits for 8820 Hz*/ ! 233: kHWRate07350 = 0x00000700, /*Hardware sampling bits for 7350 Hz*/ ! 234: ! 235: kHWRateShift = 8, ! 236: ! 237: kAWACSError = 0x00000800, /*AWACs error indicator*/ ! 238: kPortChange = 0x00001000, /*Port change indicator*/ ! 239: kEnableErrInt = 0x00002000, /*Interrupt on error enable*/ ! 240: kEnablePortChangeInt = 0x00004000, /*Interrupt on port change enable*/ ! 241: ! 242: kStatusSubFrmSel0 = 0x00000000, /*Select subframe zero status*/ ! 243: kStatusSubFrmSel1 = 0x00008000, /*Select subframe one status*/ ! 244: kStatusSubFrmSel2 = 0x00010000, /*Select subframe twoo status*/ ! 245: kStatusSubFrmSel3 = 0x00018000 /*Select subframe three status*/ ! 246: }; ! 247: ! 248: /*--------------------- AWACs Clipping Count register ------------------------------------*/ ! 249: ! 250: enum AWACsClippingCountRegisterConstants ! 251: { ! 252: kRightClippingCount = 0x000000FF, ! 253: kLeftClippingCount = 0x0000FF00 ! 254: }; ! 255:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.