annotate include/I2c_Codec.h @ 151:e9c9404e3d1f ClockSync

Pff partially working. No PID. When setting the audio clock on the bbb to 44098 the master and slave clock keep diverging instead of converging ...
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 22 Sep 2015 04:10:07 +0100
parents 8ff5668bbbad
children
rev   line source
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@132 24 short unsigned int pllJ;
giuliomoro@132 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@132 40 int setAudioSamplingRate(float newSamplingRate);
giuliomoro@151 41 double getAudioSamplingRate();
giuliomoro@132 42 short unsigned int getPllJ();
giuliomoro@132 43 unsigned int getPllD();
giuliomoro@142 44 unsigned int getPllP();
giuliomoro@142 45 unsigned int getPllR();
giuliomoro@132 46 float getPllK();
andrewm@0 47 int setDACVolume(int halfDbSteps);
andrewm@0 48 int writeDACVolumeRegisters(bool mute);
andrewm@0 49 int setADCVolume(int halfDbSteps);
andrewm@0 50 int writeADCVolumeRegisters(bool mute);
andrewm@0 51 int setHPVolume(int halfDbSteps);
andrewm@0 52 int writeHPVolumeRegisters();
andrewm@0 53
andrewm@0 54 int readI2C();
andrewm@0 55
andrewm@0 56 I2c_Codec();
andrewm@0 57 ~I2c_Codec();
andrewm@0 58
andrewm@0 59 private:
andrewm@0 60 bool running;
andrewm@0 61 int dacVolumeHalfDbs;
andrewm@0 62 int adcVolumeHalfDbs;
andrewm@0 63 int hpVolumeHalfDbs;
andrewm@0 64 };
andrewm@0 65
andrewm@0 66
andrewm@0 67 #endif /* I2CCODEC_H_ */