diff --git a/tas2557.c b/tas2557.c
index 1e674083efca086db07cf7e288bda8318fe6ff49..1779380caa08eecfb2c7eb99905e6358ae89e860 100755 (executable)
--- a/tas2557.c
+++ b/tas2557.c
char pData[16];
- printf("TAS2555 mixer command %s = %d.\n\r", pCommand, nData);
+ printf("TAS2557 mixer command %s = %d.\n\r", pCommand, nData);
sprintf(pData, "%d", nData);
pMixer[2] = pData;
sys_delay(500);
}
-void tas2557_load_configuration(int nConfiguration)
-{
- tas2557_check_node();
-
- ioctl(gTILoad, TILOAD_IOCTL_SET_CONFIG, &nConfiguration);
- sys_delay(500);
-}
-
void tas2557_load_calibration(int nCalibration)
{
tas2557_check_node();
@@ -241,7 +233,7 @@ void tas2557_coeff_write(uint8_t book, uint8_t page, uint8_t reg, uint32_t data)
}
}
-void tas2557_save_cal(TFTCConfiguration *pFTCC,
+void tas2557_save_cal(struct 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, uint32_t nResult, char * pFileName)
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){
+ if((nResult & RE1_CHK_MSK) == RESULT_PASS)
printf(" SPK A calibration success! \n\r");
- }else {
+ else {
if(nResult & RE1_FAIL_HI)
printf(" SPK A Calibration fail : Re is too high (limit: %1.2f).\n\r", pFTCC->nTSpkCharDevA.nReHi);
else
@@ -305,73 +297,73 @@ void tas2557_open_bin(char * pFileName, unsigned char dev_a, unsigned char dev_b
gnDevABlockIndex = 0;
memset(gpDevBBlock, 0, MAX_BIN_SIZE/2);
gnDevBBlockIndex = 0;
-
+
//magic number
- gpBin[gnBinIndex++] = '5';
+ gpBin[gnBinIndex++] = '5';
gpBin[gnBinIndex++] = '5';
gpBin[gnBinIndex++] = '5';
gpBin[gnBinIndex++] = '2';
-
- gnBinIndex += 4; //bypass size int
- gnBinIndex += 4; //bypass checksum int
- gnBinIndex += 4; //bypass PPC3 version int
- gnBinIndex += 4; //bypass DSP version int
-
+
+ gnBinIndex += 4; /* bypass size int */
+ gnBinIndex += 4; /* bypass checksum int */
+ gnBinIndex += 4; /* bypass PPC3 version int */
+ gnBinIndex += 4; /* bypass DSP version int */
+
gpBin[gnBinIndex++] = 0;
gpBin[gnBinIndex++] = 0;
- gpBin[gnBinIndex++] = 1;
- gpBin[gnBinIndex++] = 0; //driver version 0x00000100
-
+ gpBin[gnBinIndex++] = 1;
+ gpBin[gnBinIndex++] = 0; /* driver version 0x00000100 */
+
time(×tamp);
gpBin[gnBinIndex++] = (unsigned char)((timestamp&0xff000000)>>24);
gpBin[gnBinIndex++] = (unsigned char)((timestamp&0x00ff0000)>>16);;
- gpBin[gnBinIndex++] = (unsigned char)((timestamp&0x0000ff00)>>8);;
+ gpBin[gnBinIndex++] = (unsigned char)((timestamp&0x0000ff00)>>8);;
gpBin[gnBinIndex++] = (unsigned char)((timestamp&0x000000ff));;
-
- strcpy(&gpBin[gnBinIndex], "Calibration Data File"); //DDC name
+
+ strcpy(&gpBin[gnBinIndex], "Calibration Data File"); /* DDC name */
gnBinIndex += 64;
-
+
strcpy(&gpBin[gnBinIndex], DDC_DESCRIPTION);
gnBinIndex += strlen(DDC_DESCRIPTION) + 1;
- gnBinIndex += 4; //device family index
-
- gpBin[gnBinIndex++] = 0; //device index
- gpBin[gnBinIndex++] = 0; //device index
- gpBin[gnBinIndex++] = 0; //device index
+ 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 +=
- 2 + //num PLL index
- 0 + //array PLL index
- 2 + //num programs index
- 0 + //array programs index
- 2 + //num configurations index
- 0; //array configurations index
-
+ 2 + /* num PLL index */
+ 0 + /* array PLL index */
+ 2 + /* num programs index */
+ 0 + /* array programs index */
+ 2 + /* num configurations index */
+ 0; /* array configurations index */
+
gpBin[gnBinIndex++] = 0x00;
- gpBin[gnBinIndex++] = 0x01; // one calibration data block
+ gpBin[gnBinIndex++] = 0x01; /* one calibration data block */
strcpy(&gpBin[gnBinIndex], "Calibration snapshot");
gnBinIndex += 64;
strcpy(&gpBin[gnBinIndex], CALIBRATION_DESCRIPTION);
gnBinIndex += strlen(CALIBRATION_DESCRIPTION) + 1;
-
- gpBin[gnBinIndex++] = 0x00; // compatible program = smart amp (index 0)
- gpBin[gnBinIndex++] = 0x00; // compatible configuration
-
+
+ gpBin[gnBinIndex++] = 0x00; /* compatible program = smart amp (index 0) */
+ gpBin[gnBinIndex++] = 0x00; /* compatible configuration */
+
strcpy(&gpBin[gnBinIndex], "Calibration Data");
gnBinIndex += 64;
strcpy(&gpBin[gnBinIndex], DATA_DESCRIPTION);
gnBinIndex += strlen(DATA_DESCRIPTION) + 1;
-
- gpBin[gnBinIndex++] = 0x00; //
+
+ gpBin[gnBinIndex++] = 0x00;
gpBin[gnBinIndex++] = 2; // two blocks
-
+
gpDevABlock[0] = 0;
gpDevABlock[1] = 0;
gpDevABlock[2] = 0;
- gpDevABlock[3] = 0x03; //o COEFF_DEVICE_A – 0x03
+ gpDevABlock[3] = 0x03; /* COEFF_DEVICE_A – 0x03 */
gnDevABlockIndex = 2;
gpDevBBlock[0] = 0;
@@ -384,8 +376,7 @@ void tas2557_open_bin(char * pFileName, unsigned char dev_a, unsigned char dev_b
void tas2557_close_bin(void)
{
unsigned int nCommands;
- unsigned char pCommit[] =
- {
+ unsigned char pCommit[] = {
0x00, 0x04, 0x85, 0x00,
0x8C, 0x19, 0x7C, 0x00,
0x00, 0x00, 0x01, 0x00,
0x00, 0x35, 0x2c, 0x00,
0x00, 0x00, 0x01, 0x00
};
-
- // write the commit sequence
+
+ /* write the commit sequence */
memcpy(&gpDevABlock[gnDevABlockIndex*4], pCommit, 24);
gnDevABlockIndex += 6;
memcpy(&gpDevBBlock[gnDevBBlockIndex*4], pCommit, 24);
gnDevBBlockIndex += 6;
- // write number of commands for calibration block
+ /* write number of commands for calibration block */
gpDevABlock[4] = ((gnDevABlockIndex-2) & 0xFF000000) >> 24;
gpDevABlock[5] = ((gnDevABlockIndex-2) & 0x00FF0000) >> 16;
gpDevABlock[6] = ((gnDevABlockIndex-2) & 0x0000FF00) >> 8;
memcpy(&gpBin[gnBinIndex], gpDevBBlock, gnDevBBlockIndex*4);
gnBinIndex += (gnDevBBlockIndex*4);
- // write bin file size
+ /* write bin file size */
gpBin[4] = (gnBinIndex & 0xFF000000) >> 24;
gpBin[5] = (gnBinIndex & 0x00FF0000) >> 16;
gpBin[6] = (gnBinIndex & 0x0000FF00) >> 8;
// Description:
// Checks if speaker paramters are within bounds.
// -----------------------------------------------------------------------------
-uint32_t check_spk_bounds(TFTCConfiguration *pFTCC, double re1, double re2)
+uint32_t check_spk_bounds(struct 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;
+ 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;
+
+ return result;
}
void tas2557_ftc_release(void)