update calibration firmware creation
authorPeter Li <peter-li@ti.com>
Wed, 11 Jan 2017 13:40:56 +0000 (21:40 +0800)
committerPeter Li <peter-li@ti.com>
Wed, 11 Jan 2017 13:40:56 +0000 (21:40 +0800)
tas2557.c

index a2eceba2b780b39936844c9784251fdcb95f04ca..8929590648cb28244ff6a120ed2d36bb9ebdfce8 100755 (executable)
--- a/tas2557.c
+++ b/tas2557.c
@@ -28,6 +28,7 @@
 
 #include <sys/types.h>
 #include <stdio.h>
+#include <time.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
@@ -255,6 +256,8 @@ void tas2557_save_cal(TFTCConfiguration *pFTCC,
 void tas2557_open_bin(char * pFileName, unsigned int nConfiguration, 
        unsigned char dev_a, unsigned char dev_b)
 {
+       time_t timestamp; 
+       
        gnDevA = dev_a;
        gnDevB = dev_b;
        
@@ -271,10 +274,21 @@ void tas2557_open_bin(char * pFileName, unsigned int nConfiguration,
        gpBin[1] = '5';
        gpBin[0] = '5';
 
-       strcpy(&gpBin[24], "Calibration Data File");
-       strcpy(&gpBin[24 + 64], "Calibration Data File for TAS2555");
+       gpBin[20] = 0;
+       gpBin[21] = 0;
+       gpBin[22] = 1;  
+       gpBin[23] = 0;  //driver version 0x00000100
+       
+       time(&timestamp);
+       gpBin[24] = (unsigned char)((timestamp&0xff000000)>>24);
+       gpBin[25] = (unsigned char)((timestamp&0x00ff0000)>>16);;
+       gpBin[26] = (unsigned char)((timestamp&0x0000ff00)>>8);;        
+       gpBin[27] = (unsigned char)((timestamp&0x000000ff));;
+       
+       strcpy(&gpBin[28], "Calibration Data File");
+       strcpy(&gpBin[28 + 64], "Calibration Data File for TAS2557 Dual Mono");
 
-       gnBinIndex += 24 + 64 + strlen(&gpBin[24 + 64]) + 1;
+       gnBinIndex += 28 + 64 + strlen(&gpBin[28 + 64]) + 1;
 
        gnBinIndex += 4; //device family index
        
@@ -294,13 +308,21 @@ void tas2557_open_bin(char * pFileName, unsigned int nConfiguration,
        gpBin[gnBinIndex++] = 0x00;
        gpBin[gnBinIndex++] = 0x01; // one calibration data block
 
-       strcpy(&gpBin[gnBinIndex], "Calibration Data");
+       strcpy(&gpBin[gnBinIndex], "Calibration snapshot");
        gnBinIndex += 64;
-       strcpy(&gpBin[gnBinIndex], "Calibration Data for TAS2555");
+       strcpy(&gpBin[gnBinIndex], "Calibration snapshot for TAS2557 Dual Mono");
        gnBinIndex += strlen(&gpBin[gnBinIndex]) + 1;
        gpBin[gnBinIndex++] = 0x00; // compatible program = smart amp (index 0)
        gpBin[gnBinIndex++] = nConfiguration; // compatible configuration
        
+       strcpy(&gpBin[gnBinIndex], "Calibration Data");
+       gnBinIndex += 64;
+       strcpy(&gpBin[gnBinIndex], "Calibration Data for TAS2557 Dual Mono");
+       gnBinIndex += strlen(&gpBin[gnBinIndex]) + 1;
+       
+       gpBin[gnBinIndex++] = 0x00; // 
+       gpBin[gnBinIndex++] = 2;        // two blocks
+       
        gpDevABlock[0] = 0;
        gpDevABlock[1] = 0;
        gpDevABlock[2] = 0;