|
|
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: * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. ! 24: * ! 25: * INLINEd functions for the DAC 3550A audio Controller these ! 26: * methods are all private, so I like them better in this separate ! 27: * header rather than in the main header where the interface ! 28: * definition lays. ! 29: * ! 30: * HISTORY ! 31: * ! 32: */ ! 33: ! 34: #ifndef _PPCDACA_INLINED_H ! 35: #define _PPCDACA_INLINED_H ! 36: ! 37: #include "PPCDACA.h" ! 38: ! 39: // In debug mode we may wish to step trough the INLINEd methods, so: ! 40: #ifdef DEBUGMODE ! 41: #define INLINE ! 42: #else ! 43: #define INLINE inline ! 44: #endif ! 45: ! 46: // Generic INLINEd methods to access to registers: ! 47: // =============================================== ! 48: INLINE UInt32 ! 49: PPCDACA::ReadWordLittleEndian(void *address, UInt32 offset) ! 50: { ! 51: UInt32 *realAddress = (UInt32*)(address) + offset; ! 52: UInt32 value = *realAddress; ! 53: UInt32 newValue = ! 54: ((value & 0x000000FF) << 24) | ! 55: ((value & 0x0000FF00) << 8) | ! 56: ((value & 0x00FF0000) >> 8) | ! 57: ((value & 0xFF000000) >> 24); ! 58: ! 59: return (newValue); ! 60: } ! 61: ! 62: INLINE void ! 63: PPCDACA::WriteWordLittleEndian(void *address, UInt32 offset, UInt32 value) ! 64: { ! 65: UInt32 *realAddress = (UInt32*)(address) + offset; ! 66: UInt32 newValue = ! 67: ((value & 0x000000FF) << 24) | ! 68: ((value & 0x0000FF00) << 8) | ! 69: ((value & 0x00FF0000) >> 8) | ! 70: ((value & 0xFF000000) >> 24); ! 71: ! 72: *realAddress = newValue; ! 73: } ! 74: ! 75: // INLINEd methods to access to all the I2S registers: ! 76: // =================================================== ! 77: INLINE UInt32 ! 78: PPCDACA::I2SGetIntCtlReg() ! 79: { ! 80: return ReadWordLittleEndian(soundConfigSpace, kI2SIntCtlOffset); ! 81: } ! 82: ! 83: INLINE void ! 84: PPCDACA::I2SSetIntCtlReg(UInt32 value) ! 85: { ! 86: WriteWordLittleEndian(soundConfigSpace, kI2SIntCtlOffset, value); ! 87: } ! 88: ! 89: INLINE UInt32 ! 90: PPCDACA::I2SGetSerialFormatReg() ! 91: { ! 92: return ReadWordLittleEndian(soundConfigSpace, kI2SSerialFormatOffset); ! 93: } ! 94: ! 95: INLINE void ! 96: PPCDACA::I2SSetSerialFormatReg(UInt32 value) ! 97: { ! 98: WriteWordLittleEndian(soundConfigSpace, kI2SSerialFormatOffset, value); ! 99: } ! 100: ! 101: INLINE UInt32 ! 102: PPCDACA::I2SGetCodecMsgOutReg() ! 103: { ! 104: return ReadWordLittleEndian(soundConfigSpace, kI2SCodecMsgOutOffset); ! 105: } ! 106: ! 107: INLINE void ! 108: PPCDACA::I2SSetCodecMsgOutReg(UInt32 value) ! 109: { ! 110: WriteWordLittleEndian(soundConfigSpace, kI2SCodecMsgOutOffset, value); ! 111: } ! 112: ! 113: INLINE UInt32 ! 114: PPCDACA::I2SGetCodecMsgInReg() ! 115: { ! 116: return ReadWordLittleEndian(soundConfigSpace, kI2SCodecMsgInOffset); ! 117: } ! 118: ! 119: INLINE void ! 120: PPCDACA::I2SSetCodecMsgInReg(UInt32 value) ! 121: { ! 122: WriteWordLittleEndian(soundConfigSpace, kI2SCodecMsgInOffset, value); ! 123: } ! 124: ! 125: INLINE UInt32 ! 126: PPCDACA::I2SGetFrameCountReg() ! 127: { ! 128: return ReadWordLittleEndian(soundConfigSpace, kI2SFrameCountOffset); ! 129: } ! 130: ! 131: INLINE void ! 132: PPCDACA::I2SSetFrameCountReg(UInt32 value) ! 133: { ! 134: WriteWordLittleEndian(soundConfigSpace, kI2SFrameCountOffset, value); ! 135: } ! 136: ! 137: INLINE UInt32 ! 138: PPCDACA::I2SGetFrameMatchReg() ! 139: { ! 140: return ReadWordLittleEndian(soundConfigSpace, kI2SFrameMatchOffset); ! 141: } ! 142: ! 143: INLINE void ! 144: PPCDACA::I2SSetFrameMatchReg(UInt32 value) ! 145: { ! 146: WriteWordLittleEndian(soundConfigSpace, kI2SFrameMatchOffset, value); ! 147: } ! 148: ! 149: INLINE UInt32 ! 150: PPCDACA::I2SGetDataWordSizesReg() ! 151: { ! 152: return ReadWordLittleEndian(soundConfigSpace, kI2SDataWordSizesOffset); ! 153: } ! 154: ! 155: INLINE void ! 156: PPCDACA::I2SSetDataWordSizesReg(UInt32 value) ! 157: { ! 158: WriteWordLittleEndian(soundConfigSpace, kI2SDataWordSizesOffset, value); ! 159: } ! 160: ! 161: INLINE UInt32 ! 162: PPCDACA::I2SGetPeakLevelSelReg() ! 163: { ! 164: return ReadWordLittleEndian(soundConfigSpace, kI2SPeakLevelSelOffset); ! 165: } ! 166: ! 167: INLINE void ! 168: PPCDACA::I2SSetPeakLevelSelReg(UInt32 value) ! 169: { ! 170: WriteWordLittleEndian(soundConfigSpace, kI2SPeakLevelSelOffset, value); ! 171: } ! 172: ! 173: INLINE UInt32 ! 174: PPCDACA::I2SGetPeakLevelIn0Reg() ! 175: { ! 176: return ReadWordLittleEndian(soundConfigSpace, kI2SPeakLevelIn0Offset); ! 177: } ! 178: ! 179: INLINE void ! 180: PPCDACA::I2SSetPeakLevelIn0Reg(UInt32 value) ! 181: { ! 182: WriteWordLittleEndian(soundConfigSpace, kI2SPeakLevelIn0Offset, value); ! 183: } ! 184: ! 185: INLINE UInt32 ! 186: PPCDACA::I2SGetPeakLevelIn1Reg() ! 187: { ! 188: return ReadWordLittleEndian(soundConfigSpace, kI2SPeakLevelIn1Offset); ! 189: } ! 190: ! 191: INLINE void ! 192: PPCDACA::I2SSetPeakLevelIn1Reg(UInt32 value) ! 193: { ! 194: WriteWordLittleEndian(soundConfigSpace, kI2SPeakLevelIn1Offset, value); ! 195: } ! 196: ! 197: INLINE UInt32 ! 198: PPCDACA::I2SCounterReg() ! 199: { ! 200: return ((UInt32)(soundConfigSpace) + kI2SFrameCountOffset); ! 201: } ! 202: ! 203: // Access to Keylargo registers: ! 204: INLINE void ! 205: PPCDACA::KLSetRegister(void *klRegister, UInt32 value) ! 206: { ! 207: UInt32 *reg = (UInt32*)klRegister; ! 208: *reg = value; ! 209: } ! 210: ! 211: INLINE UInt32 ! 212: PPCDACA::KLGetRegister(void *klRegister) ! 213: { ! 214: UInt32 *reg = (UInt32*)klRegister; ! 215: return (*reg); ! 216: } ! 217: ! 218: ! 219: #endif // _PPCDACA_INLINED_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.