Annotation of XNU/iokit/Drivers/audio/drvPPCBurgundy/PPCBurgundy.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1998 Apple Computer, Inc.  All rights reserved.
                      3:  *
                      4:  * Interface definition for the Burgundy audio Controller
                      5:  *
                      6:  * HISTORY
                      7:  *
                      8:  */
                      9: 
                     10: #ifndef _PPCBURGUNDY_H
                     11: #define _PPCBURGUNDY_H
                     12: 
                     13: #include <IOKit/audio/IOAudioBus.h>
                     14: 
                     15: // Uncomment the following line to log the driver activity
                     16: //#define DEBUGMODE
                     17: 
                     18: struct IODBDMAChannelRegisters;
                     19: struct IODBDMADescriptor;
                     20: 
                     21: class PPCBurgundy : public IOAudioBus
                     22: {
                     23:     OSDeclareDefaultStructors(PPCBurgundy)
                     24: 
                     25:     // Controls for sound source and destination
                     26:     enum soundControls {
                     27:         kSpeakerMute = 0,
                     28:         kSpeakerVolLeft = 1,
                     29:         kSpeakerVolRight = 2,
                     30:         kHeadphonesMute = 3,
                     31:         kHeadphonesVolLeft = 4,
                     32:         kHeadphonesVolRight = 5,
                     33:         kMicrophoneMute = 6,
                     34:         kCDMute = 7,
                     35:         kMixerInVolLeft = 8,
                     36:         kMixerInVolRight = 9,
                     37:         kPassThruVolLeft = 10,
                     38:         kPassThruVolRight = 11,
                     39:         kPassThruMute = 12,
                     40:         kLineOutMute = 13,
                     41:         kNumControls
                     42:     };
                     43: 
                     44:     // machines that support PPCBurgundy:
                     45:     enum supportedHardware {
                     46:         kMachineNone = 0,
                     47:         kMachine9500,
                     48:         kMachineGenericGossamer,
                     49:         kMachineTypeSilk,
                     50:         kMachineTypeWallstreet,
                     51:         kMachineTypeiMac,
                     52:         kMachineTypeYosemite,
                     53:         kMachineTypeSawtooth,
                     54:         kMachineType101,
                     55:         kMachineTypeiBook,
                     56:         // Do not add anything after this:
                     57:         kMachineTypeUnknown
                     58:     };
                     59: 
                     60:     // We save here whatever machine type we find:
                     61:     int machineType;
                     62: 
                     63:     // Burgundy specific stuff:
                     64:     bool                               bOutputActive;
                     65:     bool                               bInputActive;
                     66:     volatile UInt16                    intsPending;
                     67:     UInt16                             intsSent;
                     68:     UInt16                             intsReceived;
                     69:     UInt16                             intsDelivered;
                     70: 
                     71:     // This registry entry contains a lot of useful informations about the
                     72:     // way burgundy is wired:
                     73:     IORegistryEntry *sound;
                     74: 
                     75:     // This is the base of the burgundy registers:
                     76:     UInt8                              *ioBaseBurgundy;
                     77: 
                     78:     bool                               isBordeaux;
                     79:     UInt16                             recsrc;
                     80:     UInt32                             fBlockSize;
                     81:     UInt32                             fBufMax;
                     82:     
                     83:     // Register Mirrors:
                     84:     UInt32                             soundControlRegister;
                     85:     UInt32                             CodecControlRegister[8];
                     86:     UInt32                             currentOutputMuteReg;
                     87:     UInt32                             lastStatusRegister;
                     88: 
                     89:     // for each line (in input and output) we have an audio component:
                     90:     typedef IOAudioComponentImpl *IOAudioComponentImplPtr;
                     91:     UInt16                             numInputComponents;
                     92:     UInt16                             numOutputComponents;
                     93:     IOAudioComponentImplPtr            *fInputComponents;
                     94:     IOAudioComponentImplPtr            *fOutputComponents;
                     95: 
                     96:     // There is a set of components that depend on each other (e.g. speaker
                     97:     // and headphones) the following map helps to always retrive the right
                     98:     // component.
                     99:     enum standardInputComponents {
                    100:         kMicroPhone = 0,
                    101:         kCD = 1,
                    102:         kLineIn = 2,
                    103:         kUndefinedInput
                    104:     };
                    105: 
                    106:     enum standardOutputComponents {
                    107:         kSpeaker = 0,
                    108:         kHeadphones = 1,
                    109:         kLineOut = 2,
                    110:         kUndefinedOutput
                    111:     };
                    112:     
                    113: protected:
                    114:     // Discovers if this is a burgundy compatible device:
                    115:     bool implementsBurgundy(IORegistryEntry*);
                    116: 
                    117:     // Finds the hardware the driver is running in:
                    118:     int findHostingHardware(IOService*);
                    119: 
                    120:     // Finds the number of DMA channels and their direction:
                    121:     int numOfDMAChannels();
                    122: 
                    123:     // finds the number of components for the
                    124:     // input and output lines:
                    125:     int numberOfOutputComponents();
                    126:     int numberOfInputComponents();
                    127: 
                    128:     // returns the frame rate fpr the input and output
                    129:     // channels. Possibly reading them from the registry
                    130:     UInt16 inputFrameRate();
                    131:     UInt16 outputFrameRate();
                    132: 
                    133:     // Acts on changes of the status register:
                    134:     void checkStatusRegister();
                    135:     bool inputComponentStatus(int);
                    136:     bool outputComponentStatus(int);
                    137: 
                    138:     // this handles the setup of the burgundy chip for each kind of
                    139:     // hosting hardware.
                    140:     bool dependentSetup();
                    141:     
                    142:     // Returns true if some sense line changed in the
                    143:     // status register since the last check:
                    144:     bool burgundyStatusChanged();
                    145:     
                    146:     // A mute function for each supported mute line:
                    147:     void muteInternalSpeaker(bool);
                    148:     void muteRCAOutput(bool);
                    149:     void muteHeadphones(bool);
                    150:     void muteCDLine(bool);
                    151: 
                    152:     // Sets the microphone as input source:
                    153:     void setMicInput(bool);
                    154: 
                    155:     // Scale the volume to the range used by burgundy:
                    156:     UInt8 scaleVolume(int);
                    157: 
                    158:     // sets the volume for the output lines:
                    159:     void volumeInternalSpeakerLeft(int);
                    160:     void volumeInternalSpeakerRight(int);
                    161:     
                    162:     void volumeRCAOutputLeft(int);
                    163:     void volumeRCAOutputRight(int);
                    164:     
                    165:     void volumeHeadphonesLeft(int);
                    166:     void volumeHeadphonesRight(int);
                    167:     
                    168:     void volumeCDLineLeft(int);
                    169:     void volumeCDLineRight(int);
                    170:    
                    171:     // Sets the volume of all the above together
                    172:     void volumeAllRight(int);
                    173:     void volumeAllLeft(int);
                    174:     
                    175:     // Sets the gain for the input line:
                    176:     void volumeMixerInLeft(int);
                    177:     void volumeMixerInRight(int);
                    178:     
                    179:     // A sense function for each "jacked" input:
                    180:     bool headphonesInserted();
                    181:     bool microphoneInserted();
                    182: 
                    183:     // they return the strings for the component dictionaries
                    184:     // for each kind of component
                    185:     char* componentDictionarySpeaker();
                    186:     char* componentDictionaryHeadphones();
                    187:     char* componentDictionaryMicrophone();
                    188:     char* componentDictionaryLineout();
                    189:     char* componentDictionaryCD();
                    190:     char* componentDictionaryMixerIn();
                    191:     char* componentDictionaryMixerOut();
                    192:     char* componentDictionaryPassThru();
                    193:     char* componentDictionaryLinein();
                    194: 
                    195: public:
                    196:     virtual bool init(OSDictionary *properties = 0);
                    197:     virtual void free();
                    198:     virtual IOService* probe(IOService *provider, SInt32*);
                    199:     virtual bool start(IOService*);
                    200:     virtual void stop(IOService*);
                    201:     virtual void DoClockTick(IOTimerEventSource*);
                    202:     virtual void calculateTickInterval(AbsoluteTime *tickInterval);
                    203:     
                    204:     // These are all the functions we need to override:
                    205:     virtual IOReturn SetControl(UInt16, int);
                    206:     virtual void CreateAudioTopology(class IOCommandQueue *);
                    207: };
                    208: 
                    209: #endif /* !_PPCBURGUNDY_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.