//This function contains the default I2S setting for EVM. static HRESULT diceI2sCliSetDefault(void) { // I2S Receivers i2sRxSetMckFreq (I2S_ID0, 0); i2sRxSetM192 (I2S_ID0, 0); i2sRxSetClock (I2S_ID0, TRUE, 0); i2sRxSetClockInv (I2S_ID0, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH0, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH1, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH2, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH3, 1, 1, 0, 0); i2sRxSetMckFreq (I2S_ID1, 0); i2sRxSetM192 (I2S_ID1, 0); i2sRxSetClock (I2S_ID1, TRUE, 0); i2sRxSetClockInv (I2S_ID1, 0, 0); i2sRxSetDataFormat (I2S_ID1, I2S_CH0, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID1, I2S_CH1, 1, 1, 0, 0); i2sRxSetMckFreq (I2S_ID2, 0); i2sRxSetM192 (I2S_ID2, 0); i2sRxSetClock (I2S_ID2, TRUE, 0); i2sRxSetClockInv (I2S_ID2, 0, 0); i2sRxSetDataFormat (I2S_ID2, I2S_CH0, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID2, I2S_CH1, 1, 1, 0, 0); // I2S Transmitters i2sTxSetMckFreq (I2S_ID0, 0); i2sTxSetM192 (I2S_ID0, 0); i2sTxSetClock (I2S_ID0, TRUE, 0); i2sTxSetClockInv (I2S_ID0, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH0, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH1, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH2, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH3, 1, 1, 0, 0); i2sTxSetMckFreq (I2S_ID1, 0); i2sTxSetM192 (I2S_ID1, 0); i2sTxSetClock (I2S_ID1, TRUE, 0); i2sTxSetClockInv (I2S_ID1, 0, 0); i2sTxSetDataFormat (I2S_ID1, I2S_CH0, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID1, I2S_CH1, 1, 1, 0, 0); i2sTxSetMckFreq (I2S_ID2, 0); i2sTxSetM192 (I2S_ID2, 0); i2sTxSetClock (I2S_ID2, TRUE, 0); i2sTxSetClockInv (I2S_ID2, 0, 0); i2sTxSetDataFormat (I2S_ID2, I2S_CH0, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID2, I2S_CH1, 1, 1, 0, 0); return NO_ERROR; }
static void myAppInitializeI2S(void) { // I2S Receivers i2sRxSetMckFreq (I2S_ID0, 0); i2sRxSetM192 (I2S_ID0, 0); i2sRxSetClock (I2S_ID0, TRUE, 0); i2sRxSetClockInv (I2S_ID0, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH0, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH1, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH2, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID0, I2S_CH3, 1, 1, 0, 0); i2sRxSetMckFreq (I2S_ID1, 0); i2sRxSetM192 (I2S_ID1, 0); i2sRxSetClock (I2S_ID1, TRUE, 0); i2sRxSetClockInv (I2S_ID1, 0, 0); i2sRxSetDataFormat (I2S_ID1, I2S_CH0, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID1, I2S_CH1, 1, 1, 0, 0); i2sRxSetMckFreq (I2S_ID2, 0); i2sRxSetM192 (I2S_ID2, 0); i2sRxSetClock (I2S_ID2, TRUE, 0); i2sRxSetClockInv (I2S_ID2, 0, 0); i2sRxSetDataFormat (I2S_ID2, I2S_CH0, 1, 1, 0, 0); i2sRxSetDataFormat (I2S_ID2, I2S_CH1, 1, 1, 0, 0); // I2S Transmitters i2sTxSetMckFreq (I2S_ID0, 0); i2sTxSetM192 (I2S_ID0, 0); i2sTxSetClock (I2S_ID0, TRUE, 0); i2sTxSetClockInv (I2S_ID0, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH0, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH1, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH2, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID0, I2S_CH3, 1, 1, 0, 0); i2sTxSetMckFreq (I2S_ID1, 0); i2sTxSetM192 (I2S_ID1, 0); i2sTxSetClock (I2S_ID1, TRUE, 0); i2sTxSetClockInv (I2S_ID1, 0, 0); i2sTxSetDataFormat (I2S_ID1, I2S_CH0, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID1, I2S_CH1, 1, 1, 0, 0); i2sTxSetMckFreq (I2S_ID2, 0); i2sTxSetM192 (I2S_ID2, 0); i2sTxSetClock (I2S_ID2, TRUE, 0); i2sTxSetClockInv (I2S_ID2, 0, 0); i2sTxSetDataFormat (I2S_ID2, I2S_CH0, 1, 1, 0, 0); i2sTxSetDataFormat (I2S_ID2, I2S_CH1, 1, 1, 0, 0); }
//This function is called at startup (or at mode change). This function will //initialize the DICE<->Codec interface (I2S in this example) and initialize //the codec if necessary. With this AKM codec we just initialize it the first //time it has a good clock in the msgFunc below. HRESULT akm4620_InitI2S (void) { i2sRxSetMckFreq (I2S_ID0, FALSE); //normal 256 clock i2sTxSetMckFreq (I2S_ID0, FALSE); i2sRxSetM192 (I2S_ID0, FALSE); //default to low/mid mode for now i2sTxSetM192 (I2S_ID0, FALSE); i2sRxSetClock (I2S_ID0, TRUE, 0); //256 fs @32k-96k, 128fs @176.4-192k i2sTxSetClock (I2S_ID0, TRUE, 0); i2sRxSetClockInv (I2S_ID0, TRUE, FALSE); //invert BCLK and LRCLK i2sTxSetClockInv (I2S_ID0, TRUE, FALSE); i2sRxSetDataFormat (I2S_ID0, I2S_CH0, TRUE, TRUE, 0, TRUE); i2sTxSetDataFormat (I2S_ID0, I2S_CH0, TRUE, TRUE, 0, TRUE); i2sRxSetDataFormat (I2S_ID0, I2S_CH1, TRUE, TRUE, 0, TRUE); i2sTxSetDataFormat (I2S_ID0, I2S_CH1, TRUE, TRUE, 0, TRUE); return NO_ERROR; }