#ifndef __TEXAS2_HW__
#define __TEXAS2_HW__
#include <libkern/OSTypes.h>
#define kFCR0Offset 0x00000038
#define kFCR1Offset 0x0000003C
#define kFCR2Offset 0x00000040
#define kFCR3Offset 0x00000044
#define kFCR4Offset 0x00000048
enum FCR1_Bit_Addresses { kI2S0Enable = 13,
kI2S0ClkEnBit = 12,
kI2S0SwReset = 11,
kI2S0CellEn = 10,
kChooseI2S0 = 9,
kChooseAudio = 7,
kAUDIOCellEN = 6
};
enum FCR1_Field_Width {
kI2S0Enable_bitWidth = 1,
kI2S0ClkEnBit_bitWidth = 1,
kI2S0SwReset_bitWidth = 1,
kI2S0CellEn_bitWidth = 1,
kChooseI2S0_bitWidth = 1,
kChooseAudio_bitWidth = 1,
kAUDIOCellEN_bitWidth = 1
};
enum FCR3_Bit_Addresses {
kClk18_EN_h = 14,
kClk45_EN_h = 10,
kClk49_EN_h = 9,
kShutdown_PLLKW4 = 2,
kShutdown_PLLKW6 = 1,
kShutdown_PLL_Total = 0
};
enum FCR3_FieldWidth {
kClk18_EN_h_bitWidth = 1,
kClk45_EN_h_bitWidth = 1,
kClk49_EN_h_bitWidth = 1,
kShutdown_PLLKW4_bitWidth = 1,
kShutdown_PLLKW6_bitWidth = 1,
kShutdown_PLL_Total_bitWidth = 1
};
#define kI2S0BaseOffset 0x10000
#define kI2S1BaseOffset 0x11000
#define kI2SClockOffset 0x0003C
#define kI2S0ClockEnable (UInt32)(0x00000001<<12)
#define kI2S1ClockEnable (UInt32)(0x00000001<<19)
#define kI2S0InterfaceEnable (UInt32)(0x00000001<<13)
#define kI2S1InterfaceEnable (UInt32)(0x00000001<<20)
#define kI2SIntCtlOffset 0x0000
#define kI2SSerialFormatOffset 0x0010
#define kI2SCodecMsgOutOffset 0x0020
#define kI2SCodecMsgInOffset 0x0030
#define kI2SFrameCountOffset 0x0040
#define kI2SFrameMatchOffset 0x0050
#define kI2SDataWordSizesOffset 0x0060
#define kI2SPeakLevelSelOffset 0x0070
#define kI2SPeakLevelIn0Offset 0x0080
#define kI2SPeakLevelIn1Offset 0x0090
#define kDontRestoreOnNormal 0
#define kRestoreOnNormal 1
#define kNumberOfBiquadsPerChannel 6
#define kNumberOfTexas2BiquadsPerChannel 7
#define kNumberOfCoefficientsPerBiquad 5
#define kNumberOfBiquadCoefficientsPerChannel ( kNumberOfBiquadsPerChannel * kNumberOfCoefficientsPerBiquad )
#define kNumberOfBiquadCoefficients ( kNumberOfBiquadCoefficientsPerChannel * kTexas2MaxStreamCnt )
#define kNumberOfTexas2BiquadCoefficientsPerChannel ( kNumberOfTexas2BiquadsPerChannel * kNumberOfCoefficientsPerBiquad )
#define kNumberOfTexas2BiquadCoefficients ( kNumberOfTexas2BiquadCoefficientsPerChannel * kTexas2MaxStreamCnt )
#define kHeadphoneBit 0x02
enum {
i2cBusAddrDAC3550A = 0x4d,
i2cBusSubAddrSR_REG = 0x01,
i2cBusSubAddrAVOL = 0x02,
i2cBusSubaddrGCFG = 0x03,
kSRC_48SR_REG = 0x00, kSRC_32SR_REG = 0x01, kSRC_24SR_REG = 0x02, kSRC_16SR_REG = 0x03, kSRC_12SR_REG = 0x04, kSRC_8SR_REG = 0x05, kSRC_Auto_REG = 0x06, kSampleRateControlMask = 0x07
};
enum {
kClockSourceMask = (3<<30), kClockSource18MHz = (0<<30), kClockSource45MHz = (1<<30), kClockSource49MHz = (2<<30), kMClkDivisorShift = 24, kMClkDivisorMask = (0x1F<<24), kMClkDivisor1 = (0x14<<24), kMClkDivisor3 = (0x13<<24), kMClkDivisor5 = (0x12<<24), kSClkDivisorShift = 20, kSClkDivisorMask = (0xF<<20), kSClkDivisor1 = (8<<20), kSClkDivisor3 = (9<<20), kSClkMaster = (1<<19), kSClkSlave = (0<<19), kSerialFormatShift = 16, kSerialFormatMask = (7<<16), kSerialFormatSony = (0<<16), kSerialFormat64x = (1<<16), kSerialFormat32x = (2<<16), kSerialFormatDAV = (4<<16), kSerialFormatSiliLabs = (5<<16), kExtSampleFreqIntShift = 12, kExtSampleFreqIntMask = (0xF<<12), kExtSampleFreqMask = 0xFFF };
enum {
kFrameCountEnable = (1<<31), kFrameCountPending = (1<<30), kMsgFlagEnable = (1<<29), kMsgFlagPending = (1<<28), kNewPeakEnable = (1<<27), kNewPeakPending = (1<<26), kClocksStoppedEnable = (1<<25), kClocksStoppedPending = (1<<24), kExtSyncErrorEnable = (1<<23), kExtSyncErrorPending = (1<<22), kExtSyncOKEnable = (1<<21), kExtSyncOKPending = (1<<20), kNewSampleRateEnable = (1<<19), kNewSampleRatePending = (1<<18), kStatusFlagEnable = (1<<17), kStatusFlagPending = (1<<16) };
typedef UInt8 biquadParams[15];
static biquadParams kBiquad0db = { 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#if 0
static UInt8 kTrebleRegValues[] = {
0x01, 0x09, 0x10, 0x16, 0x1C, 0x22, 0x28, 0x2D, 0x32, 0x36, 0x3A, 0x3E, 0x42, 0x45, 0x49, 0x4C, 0x4F, 0x52, 0x55, 0x57, 0x5A, 0x5C, 0x5E, 0x60, 0x62, 0x63, 0x65, 0x66, 0x68, 0x69, 0x6B, 0x6C, 0x6D, 0x6E, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96 };
static UInt8 kBassRegValues[] = {
0x01, 0x03, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0F, 0x10, 0x12, 0x13, 0x14, 0x16, 0x17, 0x18, 0x19, 0x1C, 0x1F, 0x21, 0x23, 0x25, 0x26, 0x28, 0x29, 0x2B, 0x2C, 0x2E, 0x30, 0x31, 0x33, 0x35, 0x36, 0x28, 0x39, 0x3B, 0x3C, 0x3E, 0x40, 0x42, 0x44, 0x46, 0x49, 0x4B, 0x4D, 0x4F, 0x51, 0x53, 0x54, 0x55, 0x56, 0x58, 0x59, 0x5A, 0x5C, 0x5D, 0x5F, 0x61, 0x64, 0x66, 0x69, 0x6B, 0x6D, 0x6E, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7A, 0x7D, 0x7F, 0x82, 0x86 };
#endif
static UInt32 volumeTable[] = { 0x00000000, 0x00000015, 0x00000016, 0x00000017, 0x00000019, 0x0000001A, 0x0000001C, 0x0000001D, 0x0000001F, 0x00000021, 0x00000023, 0x00000025, 0x00000027, 0x00000029, 0x0000002C, 0x0000002E, 0x00000031, 0x00000034, 0x00000037, 0x0000003A, 0x0000003E, 0x00000042, 0x00000045, 0x0000004A, 0x0000004E, 0x00000053, 0x00000057, 0x0000005D, 0x00000062, 0x00000068, 0x0000006E, 0x00000075, 0x0000007B, 0x00000083, 0x0000008B, 0x00000093, 0x0000009B, 0x000000A5, 0x000000AE, 0x000000B9, 0x000000C4, 0x000000CF, 0x000000DC, 0x000000E9, 0x000000F6, 0x00000105, 0x00000114, 0x00000125, 0x00000136, 0x00000148, 0x0000015C, 0x00000171, 0x00000186, 0x0000019E, 0x000001B6, 0x000001D0, 0x000001EB, 0x00000209, 0x00000227, 0x00000248, 0x0000026B, 0x0000028F, 0x000002B6, 0x000002DF, 0x0000030B, 0x00000339, 0x0000036A, 0x0000039E, 0x000003D5, 0x0000040F, 0x0000044C, 0x0000048D, 0x000004D2, 0x0000051C, 0x00000569, 0x000005BB, 0x00000612, 0x0000066E, 0x000006D0, 0x00000737, 0x000007A5, 0x00000818, 0x00000893, 0x00000915, 0x0000099F, 0x00000A31, 0x00000ACC, 0x00000B6F, 0x00000C1D, 0x00000CD5, 0x00000D97, 0x00000E65, 0x00000F40, 0x00001027, 0x0000111C, 0x00001220, 0x00001333, 0x00001456, 0x0000158A, 0x000016D1, 0x0000182B, 0x0000199A, 0x00001B1E, 0x00001CB9, 0x00001E6D, 0x0000203A, 0x00002223, 0x00002429, 0x0000264E, 0x00002893, 0x00002AFA, 0x00002D86, 0x00003039, 0x00003314, 0x0000361B, 0x00003950, 0x00003CB5, 0x0000404E, 0x0000441D, 0x00004827, 0x00004C6D, 0x000050F4, 0x000055C0, 0x00005AD5, 0x00006037, 0x000065EA, 0x00006BF4, 0x0000725A, 0x00007920, 0x0000804E, 0x000087EF, 0x00008FF6, 0x0000987D, 0x0000A186, 0x0000AB19, 0x0000B53C, 0x0000BFF9, 0x0000CB59, 0x0000D766, 0x0000E429, 0x0000F1AE, 0x00010000, 0x00010F2B, 0x00011F3D, 0x00013042, 0x00014249, 0x00015562, 0x0001699C, 0x00017F09, 0x000195BC, 0x0001ADC6, 0x0001C73D, 0x0001E237, 0x0001FECA, 0x00021D0E, 0x00023D1D, 0x00025F12, 0x0002830B, 0x0002A925, 0x0002D182, 0x0002FC42, 0x0003298B, 0x00035983, 0x00038C53, 0x0003C225, 0x0003FB28, 0x0004378B, 0x00047783, 0x0004BB44, 0x0005030A, 0x00054F10, 0x00059F98, 0x0005F4E5, 0x00064F40, 0x0006AEF6, 0x00071457, 0x00077FBB, 0x0007F17B };
static IOFixed volumedBTable[] = {
-70 << 16, -70 << 16, -69 << 16 | 0x8000, -69 << 16, -68 << 16 | 0x8000,
-68 << 16, -67 << 16 | 0x8000, -67 << 16, -66 << 16 | 0x8000,
-66 << 16, -65 << 16 | 0x8000, -65 << 16, -64 << 16 | 0x8000,
-64 << 16, -63 << 16 | 0x8000, -63 << 16, -62 << 16 | 0x8000,
-62 << 16, -61 << 16 | 0x8000, -61 << 16, -60 << 16 | 0x8000,
-60 << 16, -59 << 16 | 0x8000, -59 << 16, -58 << 16 | 0x8000,
-58 << 16, -57 << 16 | 0x8000, -57 << 16, -56 << 16 | 0x8000,
-56 << 16, -55 << 16 | 0x8000, -55 << 16, -54 << 16 | 0x8000,
-54 << 16, -53 << 16 | 0x8000, -53 << 16, -52 << 16 | 0x8000,
-52 << 16, -51 << 16 | 0x8000, -51 << 16, -50 << 16 | 0x8000,
-50 << 16, -49 << 16 | 0x8000, -49 << 16, -48 << 16 | 0x8000,
-48 << 16, -47 << 16 | 0x8000, -47 << 16, -46 << 16 | 0x8000,
-46 << 16, -45 << 16 | 0x8000, -45 << 16, -44 << 16 | 0x8000,
-44 << 16, -43 << 16 | 0x8000, -43 << 16, -42 << 16 | 0x8000,
-42 << 16, -41 << 16 | 0x8000, -41 << 16, -40 << 16 | 0x8000,
-40 << 16, -39 << 16 | 0x8000, -39 << 16, -38 << 16 | 0x8000,
-38 << 16, -37 << 16 | 0x8000, -37 << 16, -36 << 16 | 0x8000,
-36 << 16, -35 << 16 | 0x8000, -35 << 16, -34 << 16 | 0x8000,
-34 << 16, -33 << 16 | 0x8000, -33 << 16, -32 << 16 | 0x8000,
-32 << 16, -31 << 16 | 0x8000, -31 << 16, -30 << 16 | 0x8000,
-30 << 16, -29 << 16 | 0x8000, -29 << 16, -28 << 16 | 0x8000,
-28 << 16, -27 << 16 | 0x8000, -27 << 16, -26 << 16 | 0x8000,
-26 << 16, -25 << 16 | 0x8000, -25 << 16, -24 << 16 | 0x8000,
-24 << 16, -23 << 16 | 0x8000, -23 << 16, -22 << 16 | 0x8000,
-22 << 16, -21 << 16 | 0x8000, -21 << 16, -20 << 16 | 0x8000,
-20 << 16, -19 << 16 | 0x8000, -19 << 16, -18 << 16 | 0x8000,
-18 << 16, -17 << 16 | 0x8000, -17 << 16, -16 << 16 | 0x8000,
-16 << 16, -15 << 16 | 0x8000, -15 << 16, -14 << 16 | 0x8000,
-14 << 16, -13 << 16 | 0x8000, -13 << 16, -12 << 16 | 0x8000,
-12 << 16, -11 << 16 | 0x8000, -11 << 16, -10 << 16 | 0x8000,
-10 << 16, -9 << 16 | 0x8000, -9 << 16, -8 << 16 | 0x8000,
-8 << 16, -7 << 16 | 0x8000, -7 << 16, -6 << 16 | 0x8000,
-6 << 16, -5 << 16 | 0x8000, -5 << 16, -4 << 16 | 0x8000,
-4 << 16, -3 << 16 | 0x8000, -3 << 16, -2 << 16 | 0x8000,
-2 << 16, -1 << 16 | 0x8000, -1 << 16, -0 << 16 | 0x8000,
0 << 16, +0 << 16 | 0x8000, +1 << 16, +1 << 16 | 0x8000,
2 << 16, +2 << 16 | 0x8000, +3 << 16, +3 << 16 | 0x8000,
4 << 16, +4 << 16 | 0x8000, +5 << 16, +5 << 16 | 0x8000,
6 << 16, +6 << 16 | 0x8000, +7 << 16, +7 << 16 | 0x8000,
8 << 16, +8 << 16 | 0x8000, +9 << 16, +9 << 16 | 0x8000,
10 << 16, +10 << 16 | 0x8000, +11 << 16, +11 << 16 | 0x8000,
12 << 16, +12 << 16 | 0x8000, +13 << 16, +13 << 16 | 0x8000,
14 << 16, +14 << 16 | 0x8000, +15 << 16, +15 << 16 | 0x8000,
16 << 16, +16 << 16 | 0x8000, +17 << 16, +17 << 16 | 0x8000,
+18 << 16
};
#pragma mark -
#pragma mark ¥¥¥¥¥¥¥¥ TAS3001C Registers ¥¥¥¥¥¥¥¥
enum Texas2Registers {
kTexas2MainCtrl1Reg = 0x01, kFL = 7, kSC = 6, kE0 = 4, kF0 = 0, kW0 = 0,
kNormalLoad = 0, kFastLoad = 1,
kSerialModeLeftJust = 0, kSerialModeRightJust = 1, kSerialModeI2S = 2,
kSerialWordLength16 = 0, kSerialWordLength18 = 1, kSerialWordLength20 = 2,
k32fs = 0, k64fs = 1,
kI2SMode = ( kSerialModeI2S << kE0 ) | ( 2 << kF0 ),
kLeftJustMode = ( kSerialModeLeftJust << kE0 ) | ( kSerialModeLeftJust << kF0 ),
kRightJustMode = ( kSerialModeRightJust << kE0 ) | ( kSerialModeRightJust << kF0 ),
kTexas2DynamicRangeCtrlReg = 0x02, kTexas2VolumeCtrlReg = 0x04, kTexas2TrebleCtrlReg = 0x05, kTexas2BassCtrlReg = 0x06, kTexas2MixerLeftGainReg = 0x07, kTexas2MixerRightGainReg = 0x08, kTexas2LeftBiquad0CtrlReg = 0x0A, kTexas2LeftBiquad1CtrlReg = 0x0B, kTexas2LeftBiquad2CtrlReg = 0x0C, kTexas2LeftBiquad3CtrlReg = 0x0D, kTexas2LeftBiquad4CtrlReg = 0x0E, kTexas2LeftBiquad5CtrlReg = 0x0F, kTexas2LeftBiquad6CtrlReg = 0x10,
kTexas2RightBiquad0CtrlReg = 0x13, kTexas2RightBiquad1CtrlReg = 0x14, kTexas2RightBiquad2CtrlReg = 0x15, kTexas2RightBiquad3CtrlReg = 0x16, kTexas2RightBiquad4CtrlReg = 0x17, kTexas2RightBiquad5CtrlReg = 0x18, kTexas2RightBiquad6CtrlReg = 0x19, kTexas2LeftLoudnessBiquadReg = 0x21, kTexas2RightLoudnessBiquadReg = 0x22, kTexas2LeftLoudnessBiquadGainReg = 0x23, kTexas2RightLoudnessBiquadGainReg = 0x24, kTexas2TestReg = 0x29, kTexas2AnalogControlReg = 0x40, kTexas2Test0x41Reg = 0x41, kTexas2Text0x42Reg = 0x42, kTexas2MainCtrl2Reg = 0x43 };
enum AnalogControlReg {
kADM = 7,
kLRB = 6,
kDM = 2,
kDM0 = 2,
kDM1 = 3,
kINP = 1,
kAPD = 0,
kADMNormal = 0, kADMBInputsMonaural = 1,
kLeftInputForMonaural = 0, kRightInputForMonaural = 1,
kDeEmphasisOFF = 0, kDeEmphasis48KHz = 1, kDeEmphasis44KHz = 2,
kAnalogInputA = 0, kAnalogInputB = 1,
kPowerNormalAnalog = 0, kPowerDownAnalog = 1, kAPD_MASK = 1 };
enum MainCtrl2Reg {
kDL = 7, kNormalBassTreble = 0,
kLoadBassTreble = 1,
kAP = 1, kNormalFilter = 0,
kAllPassFilter = 1,
kFilter_MASK = 1
};
enum DRCRegisterByteIndex {
DRC_AboveThreshold,
DRC_BelowThreshold,
DRC_Threshold,
DRC_Integration,
DRC_Attack,
DRC_Decay
};
enum Texas2_DRC_Constants {
kDisableDRC = 0x59,
kDRCAboveThreshold3to1 = 0x58,
kDRCBelowThreshold1to1 = 0x02,
kDRCUnityThreshold = 0xEF,
kDRCIntegrationThreshold = 0xF0,
kDRCAttachThreshold = 0x70,
kDRCDecayThreshold = 0xB0,
kDRC_ThreholdStepSize = 750,
kDRC_CountsPerStep = 2
};
enum biquadInformation{
kBiquadRefNum_0 = 0,
kBiquadRefNum_1 = 1,
kBiquadRefNum_2 = 2,
kBiquadRefNum_3 = 3,
kBiquadRefNum_4 = 4,
kBiquadRefNum_5 = 5,
kBiquadRefNum_6 = 6,
kTexas2MaxBiquadRefNum = 6,
kTexas2NumBiquads = 6,
kTexas2CoefficientsPerBiquad = 5,
kTexas2CoefficientBitWidth = 24,
kTexas2CoefficientIntegerBitWidth = 4,
kTexas2CoefficientFractionBitWidth = 20
};
#define TAS_I2S_MODE kI2SMode
#define TAS_WORD_LENGTH kSerialWordLength20
#define ASSERT_GPIO( x ) ( 0 == x ? 0 : 1 )
#define NEGATE_GPIO( x ) ( 0 == x ? 1 : 0 )
enum Texas2_registerWidths{
kTexas2MC1Rwidth = 1,
kTexas2DRCwidth = 6,
kTexas2VOLwidth = 6,
kTexas2TREwidth = 1,
kTexas2BASwidth = 1,
kTexas2MIXERGAINwidth = 9,
kTexas2BIQwidth = ( 3 * 5 ),
kTexas2LoudnessBIQwidth = ( 3 * 5 ),
kTexas2LOUDNESSBIQUADGAINwidth = 3,
kTexas2ANALOGCTRLREGwidth = 1,
kTexas2MC2Rwidth = 1,
kTexas2MaximumRegisterWidth = ( 3 * 5 )
};
enum mixerType{
kMixerNone,
kMixerTAS3001C
};
enum TAS3001Constants {
kMixMute = 0x00000000, kMix0dB = 0x00100000 };
enum {
kStreamCountMono = 1,
kStreamCountStereo = 2
};
enum GeneralTexas2HardwareAttributeConstants {
kSampleRatesCount = 2,
kFrontLeftOFFSET = 0,
kFrontRightOFFSET = 1,
kTexas2MaxStreamCnt = kStreamCountStereo, kTexas2MaxSndSystem = 2, k16BitsPerChannel = 16,
kTexas2InputChannelDepth = kStreamCountMono,
kTexas2InputFrameSize = 16,
kTouchBiquad = 1,
kBiquadUntouched = 0
};
enum {
kStreamFrontLeft = 'fntl', kStreamFrontRight = 'fntr', kStreamSurroundLeft = 'surl', kStreamSurroundRight = 'surr', kStreamCenter = 'cntr', kStreamLFE = 'lfe ', kStreamHeadphoneLeft = 'hplf', kStreamHeadphoneRight = 'hprt', kStreamLeftOfCenter = 'loc ', kStreamRightOfCenter = 'roc ', kStreamSurround = 'sur ', kStreamSideLeft = 'sidl', kStreamSideRight = 'sidr', kStreamTop = 'top ', kStreamMono = 'mono',
kStreamVirtualHPLeft = 'vhpl', kStreamVirtualHPRight = 'vhpr',
kStreamEmbeddedSubwoofer = 'lfei', kStreamBitBucketLeft = 'sbbl', kStreamBitBucketRight = 'sbbr', kMAX_STREAM_COUNT = 20,
kStreamStereo = 'flfr' };
#define kSetBass 1
#define kSetTreble 0
#define kToneGainToRegIndex 0x38E
#define kDrcThresholdMin -35.9375
#define kDrcThresholdMax 0
#define kDrcThresholdStepSize 375
#define kDrcUnityThresholdHW (15 << 4 )
#define kDrcRatioNumerator 3
#define kDrcRationDenominator 1
#define kDefaultMaximumVolume 0
#define kTexas2VolumeStepSize 1
#define kTexas2MinVolume -70
#define kTexas2AbsMaxVolume 18
#define kTexas2MaxIntVolume 256
#define kAmpRecoveryMuteDuration 225
#define kCodecResetMakeBreakDuration 10
#define kCodec_RESET_SETUP_TIME 5
#define kCodec_RESET_HOLD_TIME 20
#define kCodec_RESET_RELEASE_TIME 10
#define kTexas2OutputSampleLatency 31
#define kTexas2InputSampleLatency 32
#define kHeadphoneAmpEntry "headphone-mute"
#define kAmpEntry "amp-mute"
#define kLineOutAmpEntry "line-output-mute"
#define kMasterAmpEntry "master-mute"
#define kHWResetEntry "audio-hw-reset"
#define kHeadphoneDetectInt "headphone-detect"
#define kLineInDetectInt "line-input-detect"
#define kLineOutDetectInt "line-output-detect"
#define kKWHeadphoneDetectInt "keywest-gpio15"
#define kDallasDetectInt "extint-gpio16"
#define kKWDallasDetectInt "keywest-gpio16"
#define kVideoPropertyEntry "video"
#define kSerialPropertyEntry "headphone-serial"
#define kGPIODTEntry "gpio"
#define kI2CDTEntry "i2c"
#define kDigitalEQDTEntry "deq"
#define ki2saEntry "i2s-a"
#define kSoundEntry "sound"
#define kNumInputs "#-inputs"
#define kDeviceID "device-id"
#define kCompatible "compatible"
#define kAAPLAddress "AAPL,address"
#define kI2CAddress "i2c-address"
#define kAudioGPIO "audio-gpio"
#define kAudioGPIOActiveState "audio-gpio-active-state"
#define kIOInterruptControllers "IOInterruptControllers"
#define kOneWireBusPropName "one-wire-bus"
#define kSpeakerIDPropValue "speaker-id"
enum UFixedPointGain{
kMinSoftwareGain = 0x00008000,
kUnitySoftwareGain = 0x00010000,
kMaxSoftwareGain = 0x00018000,
kSoftwareGainMask = 0x0001F000
};
enum TAS3001C_ResetFlags{
kNO_FORCE_RESET_SETUP_TIME = 0,
kFORCE_RESET_SETUP_TIME = 1
};
enum loadMode {
kSetNormalLoadMode = 0,
kSetFastLoadMode = 1
};
enum semaphores{
kResetSemaphoreBit = 0, kResetSemaphoreMask = ( 1 << 0 ) };
enum writeMode{
kUPDATE_SHADOW = 0,
kUPDATE_HW = 1,
kUPDATE_ALL = 2,
kFORCE_UPDATE_ALL = 3
};
enum resetRetryCount{
kTexas2_MAX_RETRY_COUNT = 5
};
enum eqPrefsVersion{
kCurrentEQPrefsVersion = 1
};
enum muteSelectors{
kHEADPHONE_AMP = 0,
kSPEAKER_AMP = 1,
kLINEOUT_AMP = 2,
kMASTER_AMP = 3
};
enum texas2delays {
kMAX_VOLUME_RAMP_DELAY = 50
};
#define kHeadphoneBitPolarity 1
#define kHeadphoneBitAddr 0
#define kHeadphoneBitMask (1 << kHeadphoneBitAddr)
#define kHeadphoneBitMatch (kHeadphoneBitPolarity << kHeadphoneBitAddr)
#define kHeadphoneDetect 1
#define kSpeakerBit 1
#pragma mark -
#pragma mark ¥¥¥¥¥¥¥¥ Structures ¥¥¥¥¥¥¥¥
#ifndef GpioActiveState
typedef Boolean GpioActiveState;
#endif
typedef struct{
UInt8 sMC1R[kTexas2MC1Rwidth]; UInt8 sDRC[kTexas2DRCwidth]; UInt8 sVOL[kTexas2VOLwidth]; UInt8 sTRE[kTexas2TREwidth]; UInt8 sBAS[kTexas2BASwidth]; UInt8 sMXL[kTexas2MIXERGAINwidth]; UInt8 sMXR[kTexas2MIXERGAINwidth]; UInt8 sLB0[kTexas2BIQwidth]; UInt8 sLB1[kTexas2BIQwidth]; UInt8 sLB2[kTexas2BIQwidth]; UInt8 sLB3[kTexas2BIQwidth]; UInt8 sLB4[kTexas2BIQwidth]; UInt8 sLB5[kTexas2BIQwidth]; UInt8 sLB6[kTexas2BIQwidth]; UInt8 sRB0[kTexas2BIQwidth]; UInt8 sRB1[kTexas2BIQwidth]; UInt8 sRB2[kTexas2BIQwidth]; UInt8 sRB3[kTexas2BIQwidth]; UInt8 sRB4[kTexas2BIQwidth]; UInt8 sRB5[kTexas2BIQwidth]; UInt8 sRB6[kTexas2BIQwidth]; UInt8 sLLB[kTexas2LoudnessBIQwidth]; UInt8 sRLB[kTexas2LoudnessBIQwidth]; UInt8 sLLBG[kTexas2LOUDNESSBIQUADGAINwidth]; UInt8 sRLBG[kTexas2LOUDNESSBIQUADGAINwidth]; UInt8 sACR[kTexas2ANALOGCTRLREGwidth]; UInt8 sMC2R[kTexas2MC2Rwidth]; }Texas2_ShadowReg;
typedef Texas2_ShadowReg Texas2_ShadowReg;
typedef Texas2_ShadowReg *Texas2_ShadowRegPtr;
struct HiLevelFilterCoefficients {
float filterFrequency;
float filterGain;
float filterQ;
UInt32 filterType;
};
typedef HiLevelFilterCoefficients * HiLevelFilterCoefficientsPtr;
struct FourDotTwenty
{
unsigned char integerAndFraction1;
unsigned char fraction2;
unsigned char fraction3;
};
typedef struct FourDotTwenty FourDotTwenty, *FourDotTwentyPtr;
union EQFilterCoefficients {
FourDotTwenty coefficient[kNumberOfCoefficientsPerBiquad]; };
typedef EQFilterCoefficients *EQFilterCoefficientsPtr;
struct EQPrefsElement {
UInt32 filterSampleRate;
UInt32 drcCompressionRatioNumerator;
UInt32 drcCompressionRatioDenominator;
SInt32 drcThreshold;
SInt32 drcMaximumVolume;
UInt32 drcEnable;
UInt32 layoutID; UInt32 deviceID; UInt32 speakerID; UInt32 reserved;
UInt32 filterCount; EQFilterCoefficients filter[14]; };
typedef EQPrefsElement *EQPrefsElementPtr;
#define kCurrentEQPrefVersion 1
struct EQPrefs {
UInt32 structVersionNumber; UInt32 genreType; UInt32 eqCount; UInt32 nameID; EQPrefsElement eq[8]; };
typedef EQPrefs *EQPrefsPtr;
struct DRCInfo {
UInt32 compressionRatioNumerator;
UInt32 compressionRatioDenominator;
SInt32 threshold;
SInt32 maximumVolume;
UInt32 maximumAvailableVolume;
UInt32 minimumAvailableVolume;
UInt32 maximumAvailableThreshold;
UInt32 minimumAvailableThreshold;
Boolean enable;
};
typedef DRCInfo *DRCInfoPtr;
enum extInt_gpio{
intEdgeSEL = 7, positiveEdge = 0, dualEdge = 1 };
enum gpio{
gpioOS = 4, gpioBit0isOutput = 0, gpioMediaBayIsOutput = 1, gpioReservedOutputSel = 2, gpioMPICopenCollector = 3,
gpioAltOE = 3, gpioOE_DDR = 0, gpioOE_Use_OS = 1,
gpioDDR = 2, gpioDDR_INPUT = 0, gpioDDR_OUTPUT = 1,
gpioPIN_RO = 1,
gpioDATA = 0,
gpioBIT_MASK = 1 };
#endif // __TEXAS2_HW__