fix bug: release tiload too early
authorPeter Li <peter-li@ti.com>
Wed, 1 Mar 2017 15:54:58 +0000 (23:54 +0800)
committerPeter Li <peter-li@ti.com>
Wed, 1 Mar 2017 15:54:58 +0000 (23:54 +0800)
tas2557.c
tas2557.h
tas2557dm_ftc.c

index 3dd9e12d19ab14335e6213ab09b02f372aead812..1e674083efca086db07cf7e288bda8318fe6ff49 100755 (executable)
--- a/tas2557.c
+++ b/tas2557.c
@@ -284,8 +284,6 @@ void tas2557_save_cal(TFTCConfiguration *pFTCC,
        fprintf(pFile, "Result = 0x%x\n\r\n\r", nResult);
 
        fclose(pFile);
-       if (gTILoad > 0)
-               close(gTILoad);
 }
 
 #define DDC_DESCRIPTION "Calibration Data File for TAS2557 Dual Mono"
@@ -454,3 +452,11 @@ uint32_t check_spk_bounds(TFTCConfiguration *pFTCC, double re1, double re2)
        
     return result; 
 } 
+
+void tas2557_ftc_release(void)
+{
+       if (gTILoad > 0) {
+               close(gTILoad);
+               gTILoad = 0;
+       }
+}
\ No newline at end of file
index 86164cc92dab4e8236bd945bd03b54c3831ec9a7..804f0a5959853bb48375c0051871ca0854ceede7 100755 (executable)
--- a/tas2557.h
+++ b/tas2557.h
@@ -56,5 +56,6 @@ uint32_t check_spk_bounds(TFTCConfiguration *pFTCC, double re1, double re2);
 void tas2557_load_calibration(int nCalibration);\r
 void tas2557_open_bin(char * pFileName, unsigned char dev_a, unsigned char dev_b);\r
 void tas2557_close_bin(void);\r
+void tas2557_ftc_release(void);\r
 \r
 #endif /* TAS2557_H_ */\r
index 915af233aa892ac8c771830eebf5a3e8b6a76c9f..10298da166acaf094e907873381aa94dbe124d52 100755 (executable)
@@ -149,7 +149,7 @@ uint32_t tas2557_ftc(double t_cal, TFTCConfiguration *pFTCC)
                if((nResult&RE2_CHK_MSK) == RESULT_PASS){\r
                        tas2557_switch_device(gpFTCC->nTSpkCharDevB.nDevAddr);\r
                        set_re(gpFTCC->nTSpkCharDevB.nPPC3_Re0, dev_b_re, gpFTCC->nTSpkCharDevB.nSpkReAlpha);\r
-                       set_temp_cal(dev_b_prm_pow, dev_b_prm_tlimit);  \r
+                       set_temp_cal(dev_b_prm_pow, dev_b_prm_tlimit);\r
                }\r
 \r
                tas2557_close_bin();\r
@@ -157,5 +157,7 @@ uint32_t tas2557_ftc(double t_cal, TFTCConfiguration *pFTCC)
 \r
        if (gpFTCC->bLoadCalibration) tas2557_load_calibration(0xFF);\r
 \r
+       tas2557_ftc_release();\r
+\r
     return result;\r
 }\r