diff --git a/tas2557.c b/tas2557.c
index 946a9f1ecc33ea2d3cc650d47622b5524f9f897e..a2eceba2b780b39936844c9784251fdcb95f04ca 100755 (executable)
--- a/tas2557.c
+++ b/tas2557.c
@@ -207,18 +207,36 @@ void tas2557_coeff_write(uint8_t book, uint8_t page, uint8_t reg, uint32_t data)
}
}
-void tas2557_save_cal(double dev_a_re, uint32_t dev_a_rms_pow, uint32_t dev_a_t_limit,
+void tas2557_save_cal(TFTCConfiguration *pFTCC,
+ double dev_a_re, uint32_t dev_a_rms_pow, uint32_t dev_a_t_limit,
double dev_b_re, uint32_t dev_b_rms_pow, uint32_t dev_b_t_limit,
- double t_cal, char * pFileName)
+ double t_cal, uint32_t nResult, char * pFileName)
{
printf("TAS2557 calibration values:\n\r");
-
printf(" DevA Re = %1.2f Ohm\n\r", dev_a_re);
printf(" DevA rms_pow = 0x%08X\n\r", dev_a_rms_pow);
printf(" DevA t_limit = 0x%08X\n\r", dev_a_t_limit);
printf(" DevB Re = %1.2f Ohm\n\r", dev_b_re);
printf(" DevB rms_pow = 0x%08X\n\r", dev_b_rms_pow);
printf(" DevB t_limit = 0x%08X\n\r", dev_b_t_limit);
+
+ if((nResult & RE1_CHK_MSK) == RESULT_PASS){
+ printf(" SPK A calibration success! \n\r");
+ }else {
+ if(nResult & RE1_FAIL_HI)
+ printf(" SPK A Calibration fail : Re is too high (limit: %1.2f).\n\r", pFTCC->nTSpkCharDevA.nReHi);
+ else
+ printf(" SPK A Calibration fail : Re is too low (limit: %1.2f).\n\r", pFTCC->nTSpkCharDevA.nReLo);
+ }
+
+ if((nResult & RE2_CHK_MSK) == RESULT_PASS){
+ printf(" SPK B calibration success! \n\r");
+ }else {
+ if(nResult & RE2_FAIL_HI)
+ printf(" SPK B Calibration fail : Re is too high (limit: %1.2f).\n\r", pFTCC->nTSpkCharDevB.nReHi);
+ else
+ printf(" SPK B Calibration fail : Re is too low (limit: %1.2f).\n\r", pFTCC->nTSpkCharDevB.nReLo);
+ }
FILE *pFile = fopen(pFileName, "w+");
@@ -229,6 +247,7 @@ void tas2557_save_cal(double dev_a_re, uint32_t dev_a_rms_pow, uint32_t dev_a_t_
fprintf(pFile, "DevB rms_pow = 0x%08X\n\r", dev_b_rms_pow);
fprintf(pFile, "DevB t_limit = 0x%08X\n\r", dev_b_t_limit);
fprintf(pFile, "Ambient temperature = %2.2f\n\r\n\r", t_cal);
+ fprintf(pFile, "Result = 0x%x\n\r\n\r", nResult);
fclose(pFile);
}
strcpy(&gpBin[24 + 64], "Calibration Data File for TAS2555");
gnBinIndex += 24 + 64 + strlen(&gpBin[24 + 64]) + 1;
+
+ gnBinIndex += 4; //device family index
+ gpBin[gnBinIndex++] = 0; //device index
+ gpBin[gnBinIndex++] = 0; //device index
+ gpBin[gnBinIndex++] = 0; //device index
+ gpBin[gnBinIndex++] = 3; //device index, TAS2557 Dual Mono
+
gnBinIndex +=
- 4 + //device family index
- 4 + //device index
2 + //num PLL index
0 + //array PLL index
2 + //num programs index
gBinFile = 0;
}
+
+// -----------------------------------------------------------------------------
+// check_spk_bounds
+// -----------------------------------------------------------------------------
+// Description:
+// Checks if speaker paramters are within bounds.
+// -----------------------------------------------------------------------------
+uint32_t check_spk_bounds(TFTCConfiguration *pFTCC, double re1, double re2)
+{
+ uint32_t result = RESULT_PASS;
+
+ if(re1>pFTCC->nTSpkCharDevA.nReHi)
+ result |= RE1_FAIL_HI;
+ if(re1<pFTCC->nTSpkCharDevA.nReLo)
+ result |= RE1_FAIL_LO;
+
+ if(re2>pFTCC->nTSpkCharDevB.nReHi)
+ result |= RE2_FAIL_HI;
+ if(re2<pFTCC->nTSpkCharDevB.nReLo)
+ result |= RE2_FAIL_LO;
+
+ return result;
+}