update FTC for PG2.1
authorPeter Li <peter-li@ti.com>
Tue, 28 Feb 2017 00:24:48 +0000 (08:24 +0800)
committerPeter Li <peter-li@ti.com>
Tue, 28 Feb 2017 00:24:48 +0000 (08:24 +0800)
factorytest.c
lib/libftc32.a [changed mode: 0644->0755]
lib/libftc64.a [changed mode: 0644->0755]
speaker_l.ftcfg
speaker_r.ftcfg
tas2557.c
tas2557.h
tas2557_ftc.h
tas2557dm_ftc.c

index d4c984b11c2f1fc55d9d3a28a7f3d3e15f527aa2..2c11645a0551ec972b713e308e61334013c610c2 100755 (executable)
@@ -64,9 +64,7 @@ void InitFTCC(TFTCConfiguration *pFTCC)
 
        pFTCC->bVerbose = false;
        pFTCC->bLoadCalibration = false;
-       pFTCC->nConfiguration = 0;
-       pFTCC->nConfigurationCalibration = 1;
-       
+
        pFTCC->nTSpkCharDevA.nSpkTMax = SPK_T_MAX;
        pFTCC->nTSpkCharDevA.nSpkReTolPer = SPK_RE_TOL_PER;
        pFTCC->nTSpkCharDevA.nSpkReAlpha = SPK_RE_ALPHA;
@@ -123,8 +121,6 @@ unsigned int RemoveComments(char *pData, char cCharacter, unsigned int nSize)
 void ReadValue(TFTCConfiguration *pFTCC, TSPKCharData *pSpk, char *pLine, char *pValue)
 {
        if (!strcmp(pLine, "CALIBRATION_TIME")) {pFTCC->nCalibrationTime = atoi(pValue); return;};
-       if (!strcmp(pLine, "CONFIGURATION")) {pFTCC->nConfiguration = atoi(pValue); return;};
-       if (!strcmp(pLine, "CONFIGURATION_CALIBRATION")) {pFTCC->nConfigurationCalibration = atoi(pValue); return;};
        if (!strcmp(pLine, "SPK_T_MAX")) {pSpk->nSpkTMax = atof(pValue); return;};
        if (!strcmp(pLine, "SPK_RE_TOL_PER")) {pSpk->nSpkReTolPer = atof(pValue); return;};
        if (!strcmp(pLine, "SPK_RE_ALPHA")) {pSpk->nSpkReAlpha = atof(pValue); return;};
@@ -148,9 +144,6 @@ void ftcc_print(TFTCConfiguration *pFTCC)
        printf("factorytest configuration: \n\r");
 
        printf("  CALIBRATION_TIME   = %d\n\r", pFTCC->nCalibrationTime);
-       printf("  CONFIGURATION             = %d\n\r", pFTCC->nConfiguration);
-       printf("  CONFIGURATION_CALIBRATION = %d\n\r\n\r", pFTCC->nConfigurationCalibration);
-       
        printf("Speaker A characterization data: \n\r");
 
        printf(" SPKA SPK_T_MAX      = %2.2f\n\r", pFTCC->nTSpkCharDevA.nSpkTMax);
@@ -198,15 +191,12 @@ int ftcc_parse(TFTCConfiguration *pFTCC, TSPKCharData *pSpk, char *pData, unsign
 //     printf("ftcc_parse: pData = %s\n\r", pData);
 
 //     printf("ftcc_parse: size = %d, pLine = 0x%08x\n\r", nSize, pLine);
-       while (pLine)
-       {
+       while (pLine) {
 //             printf("ftcc_parse: pLine = 0x%08x\n\r", pLine);
-               if (pLine[0])
-               {
+               if (pLine[0]) {
                        printf("Line = %s\n\r", pLine);
                        pEqual = strstr(pLine, "=");
-                       if ((pEqual) && (strlen(pEqual) > 1))
-                       {
+                       if ((pEqual) && (strlen(pEqual) > 1)) {
                                pEqual[0] = 0;
                                ReadValue(pFTCC, pSpk, pLine, pEqual + 1);
                                pEqual[0] = '=';
@@ -214,7 +204,7 @@ int ftcc_parse(TFTCConfiguration *pFTCC, TSPKCharData *pSpk, char *pData, unsign
                }
                pLine = strtok(NULL, "\n\r");
        }
-       
+
        return 0;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 260cbfa..e79fbaf
Binary files a/lib/libftc32.a and b/lib/libftc32.a differ
old mode 100644 (file)
new mode 100755 (executable)
index ed06926..d652b2f
Binary files a/lib/libftc64.a and b/lib/libftc64.a differ
index 90e173bf8358eb488b5a185f483af4be1e880bb9..98b6e6a536f19931f43acd2d1127fc25d841b06c 100755 (executable)
@@ -7,8 +7,6 @@
 \r
 ; FTC Settings\r
 CALIBRATION_TIME          = 6000     ; Duration (in ms) of calibration phase\r
-CONFIGURATION             = 0        ; Refer to documentation\r
-CONFIGURATION_CALIBRATION = 3        ; Refer to documentation\r
 DEV_ADDR                  = 98       ; I2C slave write addr for device A\r
 \r
 ; Obtained from Speaker Manufacturer\r
@@ -17,11 +15,11 @@ SPK_RE_TOL_PER            = 10       ; Re +/- tolerance (%)
 SPK_RE_ALPHA              = 0.0039   ; Temperature coefficient alpha (1/K)\r
 \r
 ; Pass/Fail Limits\r
-RE_HI                     = 7.975\r
-RE_LO                     = 6.525\r
+RE_HI                     = 8.0\r
+RE_LO                     = 6.0\r
 \r
 ; Obtained from PurePath Console 3 (PPC3)\r
-PPC3_RE0                  = 7.49     ; Re0 (ohm)\r
+PPC3_RE0                  = 7.0     ; Re0 (ohm)\r
 PPC3_RTV                  = 44.9     ; Rtv (K/W)\r
 PPC3_RTM                  = 80.7     ; Rtm  (K/W)\r
 PPC3_RTVA                 = 1723     ; Rtva  (K/W)\r
index 56b70e7be93df0fdcfdfc22f70fe3736b553c4ad..a90476a73b3d2796c11fd47de37bab6fcb6b5540 100755 (executable)
@@ -7,8 +7,6 @@
 \r
 ; FTC Settings\r
 CALIBRATION_TIME          = 6000     ; Duration (in ms) of calibration phase\r
-CONFIGURATION             = 0        ; Refer to documentation\r
-CONFIGURATION_CALIBRATION = 3        ; Refer to documentation\r
 DEV_ADDR                  = 9a       ; I2C slave write addr for device B\r
 \r
 ; Obtained from Speaker Manufacturer\r
@@ -17,11 +15,11 @@ SPK_RE_TOL_PER            = 10       ; Re +/- tolerance (%)
 SPK_RE_ALPHA              = 0.0039   ; Temperature coefficient alpha (1/K)\r
 \r
 ; Pass/Fail Limits\r
-RE_HI                     = 7.975\r
-RE_LO                     = 6.525\r
+RE_HI                     = 8.0\r
+RE_LO                     = 6.0\r
 \r
 ; Obtained from PurePath Console 3 (PPC3)\r
-PPC3_RE0                  = 7.49     ; Re0 (ohm)\r
+PPC3_RE0                  = 7.0     ; Re0 (ohm)\r
 PPC3_RTV                  = 44.9     ; Rtv (K/W)\r
 PPC3_RTM                  = 80.7     ; Rtm  (K/W)\r
 PPC3_RTVA                 = 1723     ; Rtva  (K/W)\r
index 1c5b788e5c2fabdaf1d88acd71f82aced740c7bc..3dd9e12d19ab14335e6213ab09b02f372aead812 100755 (executable)
--- a/tas2557.c
+++ b/tas2557.c
@@ -284,14 +284,15 @@ 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"
 #define CALIBRATION_DESCRIPTION "Calibration snapshot for TAS2557 Dual Mono"
 #define DATA_DESCRIPTION "data blocks for TAS2557 Dual Mono FTCc"
 
-void tas2557_open_bin(char * pFileName, unsigned int nConfiguration, 
-       unsigned char dev_a, unsigned char dev_b)
+void tas2557_open_bin(char * pFileName, unsigned char dev_a, unsigned char dev_b)
 {
        time_t timestamp; 
        
@@ -359,7 +360,7 @@ void tas2557_open_bin(char * pFileName, unsigned int nConfiguration,
        gnBinIndex += strlen(CALIBRATION_DESCRIPTION) + 1;
        
        gpBin[gnBinIndex++] = 0x00; // compatible program = smart amp (index 0)
-       gpBin[gnBinIndex++] = nConfiguration; // compatible configuration
+       gpBin[gnBinIndex++] = 0x00; // compatible configuration
        
        strcpy(&gpBin[gnBinIndex], "Calibration Data");
        gnBinIndex += 64;
index 31c120c4310d6d9b0ffef180b1bda2660c3809b2..86164cc92dab4e8236bd945bd03b54c3831ec9a7 100755 (executable)
--- a/tas2557.h
+++ b/tas2557.h
@@ -31,9 +31,6 @@
 \r
 #define TILOAD_IOC_MAGIC   0xE0\r
 \r
-#define CONFIGURATION 0\r
-#define CONFIGURATION_CALIBRATION 2\r
-\r
 #define TILOAD_IOCTL_SET_CHL                   _IOW(TILOAD_IOC_MAGIC, 5, int)\r
 #define TILOAD_IOCTL_SET_CONFIG                _IOW(TILOAD_IOC_MAGIC, 6, int)\r
 #define TILOAD_IOCTL_SET_CALIBRATION   _IOW(TILOAD_IOC_MAGIC, 7, int)\r
@@ -46,8 +43,6 @@
 #define RE2_FAIL_LO         0x00001000 \r
 #define RE2_CHK_MSK         0x00001100\r
 \r
-void tas2557_load_configuration(int nConfiguration);\r
-void tas2557_load_calibration(int nCalibration);\r
 uint8_t tas2557_get_PGID(void);\r
 void tas2557_mixer_command(char *pCommand, int nData);\r
 uint32_t tas2557_switch_device(uint8_t i2cslave);\r
@@ -57,9 +52,9 @@ void tas2557_save_cal(TFTCConfiguration *pFTCC,
        double dev_a_re, uint32_t dev_a_rms_pow, uint32_t dev_a_t_limit, \r
        double dev_b_re, uint32_t dev_b_rms_pow, uint32_t dev_b_t_limit, \r
        double t_cal, uint32_t,char * pFileName);\r
-uint32_t check_spk_bounds(TFTCConfiguration *pFTCC, double re1, double re2);   \r
-void tas2557_open_bin(char * pFileName, unsigned int nConfiguration, \r
-       unsigned char dev_a, unsigned char dev_b);\r
+uint32_t check_spk_bounds(TFTCConfiguration *pFTCC, double re1, double re2);\r
+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
 \r
 #endif /* TAS2557_H_ */\r
index 578b3844241657b5fc4b209b3e9d45088f3a383f..5807e21b9e0745e54a0110d2c0e0817b1fa79408 100755 (executable)
@@ -54,12 +54,9 @@ typedef struct
        bool bVerbose;\r
        bool bLoadCalibration;\r
        unsigned int nCalibrationTime;\r
-       unsigned int nConfiguration;\r
-       unsigned int nConfigurationCalibration;\r
-       \r
+\r
        TSPKCharData nTSpkCharDevA;\r
        TSPKCharData nTSpkCharDevB;\r
-       \r
 } TFTCConfiguration;\r
 \r
 uint32_t tas2557_ftc(double t_cal, TFTCConfiguration *pFTCC);\r
index 2bd848796d47f190bb565bef1e8d160be92e4976..915af233aa892ac8c771830eebf5a3e8b6a76c9f 100755 (executable)
@@ -60,40 +60,40 @@ uint32_t tas2557_ftc(double t_cal, TFTCConfiguration *pFTCC)
 \r
     gpFTCC = pFTCC;\r
 \r
+       libVersion = get_lib_ver();\r
+       printf("libVersion=0x%x\r\n", libVersion);\r
+\r
        /* get device PGID */\r
+       tas2557_switch_device(gpFTCC->nTSpkCharDevA.nDevAddr);\r
        nPGID = tas2557_get_PGID();\r
+       printf("PGID=0x%x\r\n", nPGID);\r
+\r
        /* set device PGID to FTC process */\r
        tas2557_ftc_set_PGID(nPGID);\r
-       libVersion = get_lib_ver();\r
-       printf("PGID=0x%x, libVersion=0x%x\r\n", nPGID, libVersion);\r
-\r
-    // STEP 1: Load TAS2555 calibration configuration\r
-    tas2557_load_configuration(gpFTCC->nConfigurationCalibration);\r
 \r
-    // STEP 2: Play calibration signal\r
+    // STEP 1: Play calibration signal\r
        tas2557_mixer_command("PRI_MI2S_RX Audio Mixer MultiMedia1", 1); //platform dependent\r
     nPlaybackProcess = sys_play_wav("silense.wav", "loop");\r
 \r
-       // STEP 3: Play calibration signal\r
+       // STEP 2: start calibration process\r
        tas2557_switch_device(gpFTCC->nTSpkCharDevA.nDevAddr);\r
     tas2557_ftc_start();\r
        tas2557_switch_device(gpFTCC->nTSpkCharDevB.nDevAddr);\r
        tas2557_ftc_start();\r
        \r
-    // STEP 4: Wait for algorithm to converge\r
+    // STEP 3: Wait for algorithm to converge\r
     sys_delay(gpFTCC->nCalibrationTime); // Delay \r
 \r
-       \r
-    // STEP 5: Get actual Re from TAS2555\r
+    // STEP 4: Get actual Re from TAS2557\r
        tas2557_switch_device(gpFTCC->nTSpkCharDevA.nDevAddr);\r
     dev_a_re = get_re(gpFTCC->nTSpkCharDevA.nPPC3_Re0);\r
        tas2557_switch_device(gpFTCC->nTSpkCharDevB.nDevAddr);\r
        dev_b_re = get_re(gpFTCC->nTSpkCharDevB.nPPC3_Re0);\r
 \r
-       // STEP 6: check speaker bounds\r
+       // STEP 5: check speaker bounds\r
        nResult = check_spk_bounds(gpFTCC, dev_a_re, dev_b_re);\r
        \r
-       // STEP 7: Set temperature limit to target TMAX\r
+       // STEP 6: Set temperature limit to target TMAX\r
        if((nResult& RE1_CHK_MSK) == RESULT_PASS){\r
                tas2557_switch_device(gpFTCC->nTSpkCharDevA.nDevAddr);\r
                dev_a_prm_pow = calc_prm_pow (dev_a_re, \r
@@ -139,7 +139,7 @@ uint32_t tas2557_ftc(double t_cal, TFTCConfiguration *pFTCC)
 \r
     // STEP 9: Save .bin file for TAS2555 driver\r
        if((nResult & (RE1_CHK_MSK|RE2_CHK_MSK)) == RESULT_PASS){\r
-               tas2557_open_bin("tas2557_cal.bin", gpFTCC->nConfiguration, gpFTCC->nTSpkCharDevA.nDevAddr, gpFTCC->nTSpkCharDevB.nDevAddr);\r
+               tas2557_open_bin("tas2557_cal.bin", gpFTCC->nTSpkCharDevA.nDevAddr, gpFTCC->nTSpkCharDevB.nDevAddr);\r
                if((nResult&RE1_CHK_MSK) == RESULT_PASS){\r
                        tas2557_switch_device(gpFTCC->nTSpkCharDevA.nDevAddr);\r
                        set_re(gpFTCC->nTSpkCharDevA.nPPC3_Re0, dev_a_re, gpFTCC->nTSpkCharDevA.nSpkReAlpha);\r