andrewm@0
|
1 /*
|
andrewm@0
|
2 * I2c_Codec.h
|
andrewm@0
|
3 *
|
andrewm@0
|
4 * Handle writing the registers to the TLV320AIC310x
|
andrewm@0
|
5 * series audio codecs, used on the BeagleBone Audio Cape.
|
andrewm@0
|
6 * This code is designed to bypass the ALSA driver and
|
andrewm@0
|
7 * configure the codec directly in a sensible way. It
|
andrewm@0
|
8 * is complemented by code running on the PRU which uses
|
andrewm@0
|
9 * the McASP serial port to transfer audio data.
|
andrewm@0
|
10 *
|
andrewm@0
|
11 * Created on: May 25, 2014
|
andrewm@0
|
12 * Author: Andrew McPherson
|
andrewm@0
|
13 */
|
andrewm@0
|
14
|
andrewm@0
|
15
|
andrewm@0
|
16 #ifndef I2CCODEC_H_
|
andrewm@0
|
17 #define I2CCODEC_H_
|
andrewm@0
|
18
|
andrewm@0
|
19 #include "I2c.h"
|
andrewm@0
|
20
|
andrewm@0
|
21
|
andrewm@0
|
22 class I2c_Codec : public I2c
|
andrewm@0
|
23 {
|
giuliomoro@134
|
24 short unsigned int pllJ;
|
giuliomoro@134
|
25 short unsigned int pllD;
|
giuliomoro@142
|
26 short unsigned int pllP;
|
giuliomoro@142
|
27 short unsigned int pllR;
|
andrewm@0
|
28 public:
|
andrewm@0
|
29 int writeRegister(unsigned int reg, unsigned int value);
|
andrewm@0
|
30
|
andrewm@0
|
31 int initCodec();
|
andrewm@0
|
32 int startAudio(int dual_rate);
|
andrewm@0
|
33 int stopAudio();
|
andrewm@0
|
34
|
giuliomoro@96
|
35 int setPllJ(short unsigned int j);
|
giuliomoro@96
|
36 int setPllD(unsigned int d);
|
giuliomoro@142
|
37 int setPllP(short unsigned int p);
|
giuliomoro@142
|
38 int setPllR(unsigned int r);
|
giuliomoro@96
|
39 int setPllK(float k);
|
giuliomoro@134
|
40 int setAudioSamplingRate(float newSamplingRate);
|
giuliomoro@134
|
41 short unsigned int getPllJ();
|
giuliomoro@134
|
42 unsigned int getPllD();
|
giuliomoro@142
|
43 unsigned int getPllP();
|
giuliomoro@142
|
44 unsigned int getPllR();
|
giuliomoro@134
|
45 float getPllK();
|
giuliomoro@134
|
46 float getAudioSamplingRate();
|
giuliomoro@169
|
47 int setPga(float newGain, unsigned short int channel);
|
andrewm@0
|
48 int setDACVolume(int halfDbSteps);
|
andrewm@0
|
49 int writeDACVolumeRegisters(bool mute);
|
andrewm@0
|
50 int setADCVolume(int halfDbSteps);
|
andrewm@0
|
51 int writeADCVolumeRegisters(bool mute);
|
andrewm@0
|
52 int setHPVolume(int halfDbSteps);
|
andrewm@0
|
53 int writeHPVolumeRegisters();
|
andrewm@0
|
54
|
andrewm@0
|
55 int readI2C();
|
andrewm@0
|
56
|
andrewm@0
|
57 I2c_Codec();
|
andrewm@0
|
58 ~I2c_Codec();
|
andrewm@0
|
59
|
andrewm@0
|
60 private:
|
andrewm@0
|
61 bool running;
|
andrewm@0
|
62 int dacVolumeHalfDbs;
|
andrewm@0
|
63 int adcVolumeHalfDbs;
|
andrewm@0
|
64 int hpVolumeHalfDbs;
|
andrewm@0
|
65 };
|
andrewm@0
|
66
|
andrewm@0
|
67
|
andrewm@0
|
68 #endif /* I2CCODEC_H_ */
|