developer | e0cea0f | 2021-12-16 16:08:26 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0
|
| 2 | /*
|
| 3 | * Author(s):
|
| 4 | * cdp
|
| 5 | *
|
| 6 | * Distributed by:
|
| 7 | * Silicon Laboratories, Inc
|
| 8 | *
|
| 9 | * This file contains proprietary information.
|
| 10 | * No dissemination allowed without prior written permission from
|
| 11 | * Silicon Laboratories, Inc.
|
| 12 | *
|
| 13 | * File Description:
|
| 14 | * This is the interface file for the ProSLIC test-in functions.
|
| 15 | *
|
| 16 | *
|
| 17 | */
|
| 18 |
|
| 19 | #include "../config_inc/si_voice_datatypes.h"
|
| 20 | #include "../inc/si_voice_ctrl.h"
|
| 21 | #include "../inc/si_voice_timer_intf.h"
|
| 22 | #include "../inc/proslic.h"
|
| 23 | #include "../config_inc/proslic_api_config.h"
|
| 24 | #include "../inc/proslic_tstin.h"
|
| 25 |
|
| 26 | #ifdef SI3217X
|
| 27 | #include "si3217x.h"
|
| 28 | #include "si3217x_intf.h"
|
| 29 | #endif
|
| 30 | #ifdef SI3218X
|
| 31 | #include "../inc/si3218x.h"
|
| 32 | #include "../inc/si3218x_intf.h"
|
| 33 | #endif
|
| 34 | #ifdef SI3219X
|
| 35 | #include "si3219x.h"
|
| 36 | #include "si3219x_intf.h"
|
| 37 | #endif
|
| 38 | #ifdef SI3226X
|
| 39 | #include "si3226x.h"
|
| 40 | #include "si3226x_intf.h"
|
| 41 | #endif
|
| 42 | #ifdef SI3228X
|
| 43 | #include "si3228x.h"
|
| 44 | #include "si3228x_intf.h"
|
| 45 | #endif
|
| 46 |
|
| 47 | /*
|
| 48 | ** Function Pointer Macros
|
| 49 | */
|
| 50 | #define WriteReg pProslic->deviceId->ctrlInterface->WriteRegister_fptr
|
| 51 | #define ReadReg pProslic->deviceId->ctrlInterface->ReadRegister_fptr
|
| 52 | #define pProHW pProslic->deviceId->ctrlInterface->hCtrl
|
| 53 | #define Reset pProslic->deviceId->ctrlInterface->Reset_fptr
|
| 54 | #define Delay pProslic->deviceId->ctrlInterface->Delay_fptr
|
| 55 | #define pProTimer pProslic->deviceId->ctrlInterface->hTimer
|
| 56 | #define WriteRAM pProslic->deviceId->ctrlInterface->WriteRAM_fptr
|
| 57 | #define ReadRAM pProslic->deviceId->ctrlInterface->ReadRAM_fptr
|
| 58 | #define TimeElapsed pProslic->deviceId->ctrlInterface->timeElapsed_fptr
|
| 59 | #define getTime pProslic->deviceId->ctrlInterface->getTime_fptr
|
| 60 | #define SetSemaphore pProslic->deviceId->ctrlInterface->Semaphore_fptr
|
| 61 |
|
| 62 | #define WriteRegX deviceId->ctrlInterface->WriteRegister_fptr
|
| 63 | #define ReadRegX deviceId->ctrlInterface->ReadRegister_fptr
|
| 64 | #define pProHWX deviceId->ctrlInterface->hCtrl
|
| 65 | #define DelayX deviceId->ctrlInterface->Delay_fptr
|
| 66 | #define pProTimerX deviceId->ctrlInterface->hTimer
|
| 67 | #define WriteRAMX deviceId->ctrlInterface->WriteRAM_fptr
|
| 68 | #define ReadRAMX deviceId->ctrlInterface->ReadRAM_fptr
|
| 69 | #define getTimeX deviceId->ctrlInterface->getTime_fptr
|
| 70 | #define TimeElapsedX deviceId->ctrlInterface->timeElapsed_fptr
|
| 71 |
|
| 72 | /*
|
| 73 | * Valid Device Number Ranges
|
| 74 | */
|
| 75 |
|
| 76 | #define TSTIN_VALID_SI3217X_PART_NUM (pProslic->deviceId->chipType >= SI32171 && pProslic->deviceId->chipType <= SI32179)
|
| 77 | #define TSTIN_VALID_SI3218X_PART_NUM (pProslic->deviceId->chipType >= SI32180 && pProslic->deviceId->chipType <= SI32189)
|
| 78 | #define TSTIN_VALID_SI3219X_PART_NUM (pProslic->deviceId->chipType >= SI32190 && pProslic->deviceId->chipType <= SI32199)
|
| 79 | #define TSTIN_VALID_SI3226X_PART_NUM (pProslic->deviceId->chipType >= SI32260 && pProslic->deviceId->chipType <= SI32269)
|
| 80 | #define TSTIN_VALID_SI3228X_PART_NUM (pProslic->deviceId->chipType >= SI32280 && pProslic->deviceId->chipType <= SI32289)
|
| 81 |
|
| 82 | #define TSTIN_INVALID_PART_NUM !(TSTIN_VALID_SI3217X_PART_NUM ||\
|
| 83 | TSTIN_VALID_SI3218X_PART_NUM || TSTIN_VALID_SI3219X_PART_NUM ||\
|
| 84 | TSTIN_VALID_SI3226X_PART_NUM || TSTIN_VALID_SI3228X_PART_NUM)
|
| 85 |
|
| 86 | #define LOGPRINT_PREFIX "ProSLIC:"
|
| 87 |
|
| 88 | ProSLIC_DCfeed_Cfg ringtripTestDCFeedPreset[] =
|
| 89 | {
|
| 90 | {
|
| 91 | 0x196038D8L, /* SLOPE_VLIM */
|
| 92 | 0x1D707651L, /* SLOPE_RFEED */
|
| 93 | 0x0040A0E0L, /* SLOPE_ILIM */
|
| 94 | 0x1E07FE48L, /* SLOPE_DELTA1 */
|
| 95 | 0x1ED62D87L, /* SLOPE_DELTA2 */
|
| 96 | 0x01A50724L, /* V_VLIM (14.000 v) */
|
| 97 | 0x016EE54FL, /* V_RFEED (12.200 v) */
|
| 98 | 0x012CBBF5L, /* V_ILIM (10.000 v) */
|
| 99 | 0x00AF8C10L, /* CONST_RFEED (10.000 mA) */
|
| 100 | 0x0045CBBCL, /* CONST_ILIM (15.000 mA) */
|
| 101 | 0x000D494BL, /* I_VLIM (0.000 mA) */
|
| 102 | 0x005B0AFBL, /* LCRONHK (10.000 mA) */
|
| 103 | 0x006D4060L, /* LCROFFHK (12.000 mA) */
|
| 104 | 0x00008000L, /* LCRDBI (5.000 ms) */
|
| 105 | 0x0048D595L, /* LONGHITH (8.000 mA) */
|
| 106 | 0x003FBAE2L, /* LONGLOTH (7.000 mA) */
|
| 107 | 0x00008000L, /* LONGDBI (5.000 ms) */
|
| 108 | 0x000F0000L, /* LCRMASK (150.000 ms) */
|
| 109 | 0x00080000L, /* LCRMASK_POLREV (80.000 ms) */
|
| 110 | 0x00140000L, /* LCRMASK_STATE (200.000 ms) */
|
| 111 | 0x00140000L, /* LCRMASK_LINECAP (200.000 ms) */
|
| 112 | 0x01999999L, /* VCM_OH (25.000 v) */
|
| 113 | 0x0051EB85L, /* VOV_BAT (5.000 v) */
|
| 114 | 0x00418937L /* VOV_GND (4.000 v) */
|
| 115 | }
|
| 116 | };
|
| 117 |
|
| 118 | /*
|
| 119 | ** dB lookup table
|
| 120 | */
|
| 121 | #define DB_TABLE_STEP_SIZE 250
|
| 122 | #define MAX_DB_TABLE 279
|
| 123 |
|
| 124 | static const uInt32 dBTable10_n60 [] =
|
| 125 | {
|
| 126 | 31623,
|
| 127 | 30726,
|
| 128 | 29854,
|
| 129 | 29007,
|
| 130 | 28184,
|
| 131 | 27384,
|
| 132 | 26607,
|
| 133 | 25852,
|
| 134 | 25119,
|
| 135 | 24406,
|
| 136 | 23714,
|
| 137 | 23041,
|
| 138 | 22387,
|
| 139 | 21752,
|
| 140 | 21135,
|
| 141 | 20535,
|
| 142 | 19953,
|
| 143 | 19387,
|
| 144 | 18836,
|
| 145 | 18302,
|
| 146 | 17783,
|
| 147 | 17278,
|
| 148 | 16788,
|
| 149 | 16312,
|
| 150 | 15849,
|
| 151 | 15399,
|
| 152 | 14962,
|
| 153 | 14538,
|
| 154 | 14125,
|
| 155 | 13725,
|
| 156 | 13335,
|
| 157 | 12957,
|
| 158 | 12589,
|
| 159 | 12232,
|
| 160 | 11885,
|
| 161 | 11548,
|
| 162 | 11220,
|
| 163 | 10902,
|
| 164 | 10593,
|
| 165 | 10292,
|
| 166 | 10000,
|
| 167 | 9716,
|
| 168 | 9441,
|
| 169 | 9173,
|
| 170 | 8913,
|
| 171 | 8660,
|
| 172 | 8414,
|
| 173 | 8175,
|
| 174 | 7943,
|
| 175 | 7718,
|
| 176 | 7499,
|
| 177 | 7286,
|
| 178 | 7079,
|
| 179 | 6879,
|
| 180 | 6683,
|
| 181 | 6494,
|
| 182 | 6310,
|
| 183 | 6131,
|
| 184 | 5957,
|
| 185 | 5788,
|
| 186 | 5623,
|
| 187 | 5464,
|
| 188 | 5309,
|
| 189 | 5158,
|
| 190 | 5012,
|
| 191 | 4870,
|
| 192 | 4732,
|
| 193 | 4597,
|
| 194 | 4467,
|
| 195 | 4340,
|
| 196 | 4217,
|
| 197 | 4097,
|
| 198 | 3981,
|
| 199 | 3868,
|
| 200 | 3758,
|
| 201 | 3652,
|
| 202 | 3548,
|
| 203 | 3447,
|
| 204 | 3350,
|
| 205 | 3255,
|
| 206 | 3162,
|
| 207 | 3073,
|
| 208 | 2985,
|
| 209 | 2901,
|
| 210 | 2818,
|
| 211 | 2738,
|
| 212 | 2661,
|
| 213 | 2585,
|
| 214 | 2512,
|
| 215 | 2441,
|
| 216 | 2371,
|
| 217 | 2304,
|
| 218 | 2239,
|
| 219 | 2175,
|
| 220 | 2113,
|
| 221 | 2054,
|
| 222 | 1995,
|
| 223 | 1939,
|
| 224 | 1884,
|
| 225 | 1830,
|
| 226 | 1778,
|
| 227 | 1728,
|
| 228 | 1679,
|
| 229 | 1631,
|
| 230 | 1585,
|
| 231 | 1540,
|
| 232 | 1496,
|
| 233 | 1454,
|
| 234 | 1413,
|
| 235 | 1372,
|
| 236 | 1334,
|
| 237 | 1296,
|
| 238 | 1259,
|
| 239 | 1223,
|
| 240 | 1189,
|
| 241 | 1155,
|
| 242 | 1122,
|
| 243 | 1090,
|
| 244 | 1059,
|
| 245 | 1029,
|
| 246 | 1000,
|
| 247 | 972,
|
| 248 | 944,
|
| 249 | 917,
|
| 250 | 891,
|
| 251 | 866,
|
| 252 | 841,
|
| 253 | 818,
|
| 254 | 794,
|
| 255 | 772,
|
| 256 | 750,
|
| 257 | 729,
|
| 258 | 708,
|
| 259 | 688,
|
| 260 | 668,
|
| 261 | 649,
|
| 262 | 631,
|
| 263 | 613,
|
| 264 | 596,
|
| 265 | 579,
|
| 266 | 562,
|
| 267 | 546,
|
| 268 | 531,
|
| 269 | 516,
|
| 270 | 501,
|
| 271 | 487,
|
| 272 | 473,
|
| 273 | 460,
|
| 274 | 447,
|
| 275 | 434,
|
| 276 | 422,
|
| 277 | 410,
|
| 278 | 398,
|
| 279 | 387,
|
| 280 | 376,
|
| 281 | 365,
|
| 282 | 355,
|
| 283 | 345,
|
| 284 | 335,
|
| 285 | 325,
|
| 286 | 316,
|
| 287 | 307,
|
| 288 | 299,
|
| 289 | 290,
|
| 290 | 282,
|
| 291 | 274,
|
| 292 | 266,
|
| 293 | 259,
|
| 294 | 251,
|
| 295 | 244,
|
| 296 | 237,
|
| 297 | 230,
|
| 298 | 224,
|
| 299 | 218,
|
| 300 | 211,
|
| 301 | 205,
|
| 302 | 200,
|
| 303 | 194,
|
| 304 | 188,
|
| 305 | 183,
|
| 306 | 178,
|
| 307 | 173,
|
| 308 | 168,
|
| 309 | 163,
|
| 310 | 158,
|
| 311 | 154,
|
| 312 | 150,
|
| 313 | 145,
|
| 314 | 141,
|
| 315 | 137,
|
| 316 | 133,
|
| 317 | 130,
|
| 318 | 126,
|
| 319 | 122,
|
| 320 | 119,
|
| 321 | 115,
|
| 322 | 112,
|
| 323 | 109,
|
| 324 | 106,
|
| 325 | 103,
|
| 326 | 100,
|
| 327 | 97,
|
| 328 | 94,
|
| 329 | 92,
|
| 330 | 89,
|
| 331 | 87,
|
| 332 | 84,
|
| 333 | 82,
|
| 334 | 79,
|
| 335 | 77,
|
| 336 | 75,
|
| 337 | 73,
|
| 338 | 71,
|
| 339 | 69,
|
| 340 | 67,
|
| 341 | 65,
|
| 342 | 63,
|
| 343 | 61,
|
| 344 | 60,
|
| 345 | 58,
|
| 346 | 56,
|
| 347 | 55,
|
| 348 | 53,
|
| 349 | 52,
|
| 350 | 50,
|
| 351 | 49,
|
| 352 | 47,
|
| 353 | 46,
|
| 354 | 45,
|
| 355 | 43,
|
| 356 | 42,
|
| 357 | 41,
|
| 358 | 40,
|
| 359 | 39,
|
| 360 | 38,
|
| 361 | 37,
|
| 362 | 35,
|
| 363 | 34,
|
| 364 | 33,
|
| 365 | 33,
|
| 366 | 32,
|
| 367 | 31,
|
| 368 | 30,
|
| 369 | 29,
|
| 370 | 28,
|
| 371 | 27,
|
| 372 | 27,
|
| 373 | 26,
|
| 374 | 25,
|
| 375 | 24,
|
| 376 | 24,
|
| 377 | 23,
|
| 378 | 22,
|
| 379 | 22,
|
| 380 | 21,
|
| 381 | 21,
|
| 382 | 20,
|
| 383 | 19,
|
| 384 | 19,
|
| 385 | 18,
|
| 386 | 18,
|
| 387 | 17,
|
| 388 | 17,
|
| 389 | 16,
|
| 390 | 16,
|
| 391 | 15,
|
| 392 | 15,
|
| 393 | 15,
|
| 394 | 14,
|
| 395 | 14,
|
| 396 | 13,
|
| 397 | 13,
|
| 398 | 13,
|
| 399 | 12,
|
| 400 | 12,
|
| 401 | 12,
|
| 402 | 11,
|
| 403 | 11,
|
| 404 | 11,
|
| 405 | 10,
|
| 406 | 10
|
| 407 | };
|
| 408 |
|
| 409 |
|
| 410 | /* *********************************** */
|
| 411 | static int setInternalTestLoad(proslicChanType *pProslic, int connect)
|
| 412 | {
|
| 413 | ramData ram_save;
|
| 414 | ramData test_load_addr;
|
| 415 | ramData test_load_bitmask;
|
| 416 |
|
| 417 | if(pProslic->deviceId->chipType >= SI32171
|
| 418 | && pProslic->deviceId->chipType <= SI32179)
|
| 419 | {
|
| 420 | test_load_addr = 1516;
|
| 421 | test_load_bitmask = 0x00800000L; /* bit 23 */
|
| 422 | }
|
| 423 | else
|
| 424 | {
|
| 425 | test_load_addr = 1611;
|
| 426 | test_load_bitmask = 0x00040000L; /* bit 18 */
|
| 427 | }
|
| 428 |
|
| 429 | ProSLIC_SetUserMode(pProslic,1,0);
|
| 430 | ram_save = ProSLIC_ReadRAM(pProslic,test_load_addr);
|
| 431 |
|
| 432 | if(connect)
|
| 433 | {
|
| 434 | ram_save |= test_load_bitmask;
|
| 435 | }
|
| 436 | else
|
| 437 | {
|
| 438 | ram_save &= ~test_load_bitmask;
|
| 439 | }
|
| 440 |
|
| 441 | ProSLIC_WriteRAM(pProslic,test_load_addr,ram_save);
|
| 442 |
|
| 443 | return RC_NONE;
|
| 444 | }
|
| 445 |
|
| 446 | /* *********************************** */
|
| 447 | static void setup1kHzBandpass(proslicChanType *pProslic)
|
| 448 | {
|
| 449 | /* 1kHz bandpass - Gain = -1.7055 */
|
| 450 | ProSLIC_WriteRAM(pProslic, 32, 0x180A50L); /* TESTB0_1 */
|
| 451 | ProSLIC_WriteRAM(pProslic, 33, 0x0L); /* TESTB1_1 */
|
| 452 | ProSLIC_WriteRAM(pProslic, 34, 0x1FE7F5B0L);/* TESTB2_1 */
|
| 453 | ProSLIC_WriteRAM(pProslic, 35, 0xB166220L); /* TESTA1_1 */
|
| 454 | ProSLIC_WriteRAM(pProslic, 36, 0x185119D0L);/* TESTA2_1 */
|
| 455 | ProSLIC_WriteRAM(pProslic, 37, 0xAF624E0L); /* TESTB0_2 */
|
| 456 | ProSLIC_WriteRAM(pProslic, 38, 0x0L); /* TESTB1_2 */
|
| 457 | ProSLIC_WriteRAM(pProslic, 39, 0xAF624E0L); /* TESTB2_2 */
|
| 458 | ProSLIC_WriteRAM(pProslic, 40, 0x0L); /* TESTA1_2 */
|
| 459 | ProSLIC_WriteRAM(pProslic, 41, 0x185119D0L);/* TESTA2_2 */
|
| 460 | ProSLIC_WriteRAM(pProslic, 42, 0x7C6E410L); /* TESTB0_3 */
|
| 461 | ProSLIC_WriteRAM(pProslic, 43, 0xAFF8B80L); /* TESTB1_3 */
|
| 462 | ProSLIC_WriteRAM(pProslic, 44, 0x7C6E410L); /* TESTB2_3 */
|
| 463 | ProSLIC_WriteRAM(pProslic, 45, 0x14E99DE0L);/* TESTA1_3 */
|
| 464 | ProSLIC_WriteRAM(pProslic, 46, 0x185119D0L);/* TESTA2_3 */
|
| 465 | ProSLIC_WriteRAM(pProslic, 50, 0x40000L); /* TESTAVBW */
|
| 466 | ProSLIC_WriteRAM(pProslic, 49, 0x1F40000L); /* TESTWLN */
|
| 467 | ProSLIC_WriteRAM(pProslic, 54, 0x0L); /* TESTAVTH */
|
| 468 | ProSLIC_WriteRAM(pProslic, 53, 0x0L); /* TESTPKTH */
|
| 469 | }
|
| 470 |
|
| 471 | /* *********************************** */
|
| 472 | /* Return value in dB*1000 (mdB) */
|
| 473 | static int32 dBLookup(uInt32 number)
|
| 474 | {
|
| 475 | int i;
|
| 476 | uInt32 err;
|
| 477 |
|
| 478 | if(number >= dBTable10_n60[0])
|
| 479 | {
|
| 480 | return 10000; /* out of range - clamp at 10dB */
|
| 481 | }
|
| 482 |
|
| 483 | for(i=0; i<MAX_DB_TABLE; i++) /* 139 */
|
| 484 | {
|
| 485 | if((number < dBTable10_n60[i])&&(number >= dBTable10_n60[i+1]))
|
| 486 | {
|
| 487 | /* See which level it is closest to */
|
| 488 | err = dBTable10_n60[i] - number;
|
| 489 | if(err < (number - dBTable10_n60[i+1]))
|
| 490 | {
|
| 491 | return (10000 - i*DB_TABLE_STEP_SIZE);
|
| 492 | }
|
| 493 | else
|
| 494 | {
|
| 495 | return (10000 - (i+1)*DB_TABLE_STEP_SIZE);
|
| 496 | }
|
| 497 | }
|
| 498 | }
|
| 499 | /* No solution found? Return -60dB */
|
| 500 | return -60000;
|
| 501 | }
|
| 502 |
|
| 503 | /* *********************************** */
|
| 504 | static int32 readAudioDiagLevel(proslicChanType *pProslic,int32 zero_dbm_mvpk)
|
| 505 | {
|
| 506 | int32 data;
|
| 507 |
|
| 508 | data = ProSLIC_ReadRAM(pProslic,47); /* TESTPKO */
|
| 509 | DEBUG_PRINT(pProslic, "TESTPKO = %d\n", (int)data);
|
| 510 |
|
| 511 | data /= 40145; /* 2^28 * 0.182 * 10^(Gfilt/20) */
|
| 512 | data *= 1000;
|
| 513 | data /= zero_dbm_mvpk;
|
| 514 | data *= 10;
|
| 515 |
|
| 516 | return(dBLookup(data));
|
| 517 | }
|
| 518 |
|
| 519 | /* *********************************** */
|
| 520 | static char *applyTestLimits(proslicTestObj *test)
|
| 521 | {
|
| 522 | if((test->value >= test->lowerLimit)&&(test->value <= test->upperLimit))
|
| 523 | {
|
| 524 | test->testResult = RC_TEST_PASSED;
|
| 525 | return ("PASS");
|
| 526 | }
|
| 527 | else
|
| 528 | {
|
| 529 | test->testResult = RC_TEST_FAILED;
|
| 530 | return ("FAIL");
|
| 531 | }
|
| 532 | }
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 | /* *********************************** */
|
| 537 | static int logTest(proslicChanType *pProslic,proslicTestObj *test,
|
| 538 | const char *label)
|
| 539 | {
|
| 540 | char resultStr[10];
|
| 541 | SIVOICE_STRCPY(resultStr,applyTestLimits(test));
|
| 542 | DEBUG_PRINT(pProslic, "ProSLIC : TestIn : %-14s = %-8d :: %s\n", label, (int)(test->value),
|
| 543 | resultStr);
|
| 544 | #ifndef ENABLE_DEBUG
|
| 545 | SILABS_UNREFERENCED_PARAMETER(pProslic);
|
| 546 | SILABS_UNREFERENCED_PARAMETER(label);
|
| 547 | #endif
|
| 548 | return test->testResult;
|
| 549 |
|
| 550 | }
|
| 551 | /* *********************************** */
|
| 552 | static int logStatus(proslicChanType *pProslic, int status,const char *label)
|
| 553 | {
|
| 554 | DEBUG_PRINT(pProslic, "ProSLIC : TestIn : %-14s = %d\n", label,status);
|
| 555 | #ifndef ENABLE_DEBUG
|
| 556 | SILABS_UNREFERENCED_PARAMETER(pProslic);
|
| 557 | SILABS_UNREFERENCED_PARAMETER(label);
|
| 558 | SILABS_UNREFERENCED_PARAMETER(status);
|
| 559 | #endif
|
| 560 | return RC_NONE;
|
| 561 | }
|
| 562 |
|
| 563 | /* *********************************** */
|
| 564 | static uInt32 Isqrt32(uInt32 num)
|
| 565 | {
|
| 566 | uInt32 one,res,op;
|
| 567 |
|
| 568 | op=num;
|
| 569 | res=0;
|
| 570 | one = 1L << 30;
|
| 571 | while(one > op)
|
| 572 | {
|
| 573 | one >>=2;
|
| 574 | }
|
| 575 |
|
| 576 | while(one !=0)
|
| 577 | {
|
| 578 | if(op >= res + one)
|
| 579 | {
|
| 580 | op = op - (res + one);
|
| 581 | res = res + 2*one;
|
| 582 | }
|
| 583 | res >>= 1;
|
| 584 | one >>= 2;
|
| 585 | }
|
| 586 |
|
| 587 | return (res);
|
| 588 | }
|
| 589 |
|
| 590 |
|
| 591 | /* *********************************** */
|
| 592 | static int storeDCFeedPreset(proslicChanType *pProslic,ProSLIC_DCfeed_Cfg *cfg,uInt8 preset)
|
| 593 | {
|
| 594 | cfg[preset].slope_vlim = ProSLIC_ReadRAM(pProslic,634);
|
| 595 | cfg[preset].slope_rfeed = ProSLIC_ReadRAM(pProslic,635);
|
| 596 | cfg[preset].slope_ilim = ProSLIC_ReadRAM(pProslic,636);
|
| 597 | cfg[preset].delta1 = ProSLIC_ReadRAM(pProslic,638);
|
| 598 | cfg[preset].delta2 = ProSLIC_ReadRAM(pProslic,639);
|
| 599 | cfg[preset].v_vlim = ProSLIC_ReadRAM(pProslic,640);
|
| 600 | cfg[preset].v_rfeed = ProSLIC_ReadRAM(pProslic,641);
|
| 601 | cfg[preset].v_ilim = ProSLIC_ReadRAM(pProslic,642);
|
| 602 | cfg[preset].const_rfeed = ProSLIC_ReadRAM(pProslic,643);
|
| 603 | cfg[preset].const_ilim = ProSLIC_ReadRAM(pProslic,644);
|
| 604 | cfg[preset].i_vlim = ProSLIC_ReadRAM(pProslic,645);
|
| 605 | cfg[preset].lcronhk = ProSLIC_ReadRAM(pProslic,853);
|
| 606 | cfg[preset].lcroffhk = ProSLIC_ReadRAM(pProslic,852);
|
| 607 | cfg[preset].lcrdbi = ProSLIC_ReadRAM(pProslic,701);
|
| 608 | cfg[preset].longhith = ProSLIC_ReadRAM(pProslic,858);
|
| 609 | cfg[preset].longloth = ProSLIC_ReadRAM(pProslic,859);
|
| 610 | cfg[preset].longdbi = ProSLIC_ReadRAM(pProslic,702);
|
| 611 | cfg[preset].lcrmask = ProSLIC_ReadRAM(pProslic,854);
|
| 612 | cfg[preset].lcrmask_polrev = ProSLIC_ReadRAM(pProslic,855);
|
| 613 | cfg[preset].lcrmask_state = ProSLIC_ReadRAM(pProslic,856);
|
| 614 | cfg[preset].lcrmask_linecap = ProSLIC_ReadRAM(pProslic,857);
|
| 615 | cfg[preset].vcm_oh = ProSLIC_ReadRAM(pProslic,748);
|
| 616 | cfg[preset].vov_bat = ProSLIC_ReadRAM(pProslic,752);
|
| 617 | cfg[preset].vov_gnd = ProSLIC_ReadRAM(pProslic,751);
|
| 618 |
|
| 619 | return RC_NONE;
|
| 620 | }
|
| 621 |
|
| 622 |
|
| 623 | /* *********************************** */
|
| 624 | int ProSLIC_createTestInObjs(proslicTestInObjType_ptr *pTstin, uInt32 num_objs)
|
| 625 | {
|
| 626 | #ifndef DISABLE_MALLOC
|
| 627 | *pTstin = SIVOICE_CALLOC(sizeof(proslicTestInObjType),num_objs);
|
| 628 |
|
| 629 | if(*pTstin == NULL)
|
| 630 | {
|
| 631 | #ifdef ENABLE_DEBUG
|
| 632 | LOGPRINT("%s: %s: failed to allocate memory", LOGPRINT_PREFIX, __FUNCTION__);
|
| 633 | #endif
|
| 634 | return RC_NO_MEM;
|
| 635 | }
|
| 636 |
|
| 637 | return RC_NONE;
|
| 638 | #else
|
| 639 | SILABS_UNREFERENCED_PARAMETER(pTstin);
|
| 640 | SILABS_UNREFERENCED_PARAMETER(num_objs);
|
| 641 | return RC_UNSUPPORTED_FEATURE;
|
| 642 | #endif
|
| 643 | }
|
| 644 | /* *********************************** */
|
| 645 | int ProSLIC_destroyTestInObjs(proslicTestInObjType_ptr *pTstin)
|
| 646 | {
|
| 647 | #ifndef DISABLE_MALLOC
|
| 648 | SIVOICE_FREE((proslicTestInObjType_ptr) *pTstin);
|
| 649 | *pTstin = NULL;
|
| 650 | return RC_NONE;
|
| 651 | #else
|
| 652 | SILABS_UNREFERENCED_PARAMETER(pTstin);
|
| 653 | return RC_UNSUPPORTED_FEATURE;
|
| 654 | #endif
|
| 655 | }
|
| 656 |
|
| 657 | /* *********************************** */
|
| 658 | int ProSLIC_testInPCMLpbkEnable(proslicChanType *pProslic,
|
| 659 | proslicTestInObjType *pTstin)
|
| 660 | {
|
| 661 | uInt8 regData;
|
| 662 |
|
| 663 | /* Valid device check */
|
| 664 | if(TSTIN_INVALID_PART_NUM)
|
| 665 | {
|
| 666 | return RC_UNSUPPORTED_FEATURE;
|
| 667 | }
|
| 668 |
|
| 669 | /* Check if enabled */
|
| 670 | if(!pTstin->pcmLpbkTest.testEnable)
|
| 671 | {
|
| 672 | return RC_TEST_DISABLED;
|
| 673 | }
|
| 674 | /* Return if already enabled */
|
| 675 | if(pTstin->pcmLpbkTest.pcmLpbkEnabled)
|
| 676 | {
|
| 677 | return RC_NONE;
|
| 678 | }
|
| 679 |
|
| 680 | /* Store PCM Settings */
|
| 681 | pTstin->pcmLpbkTest.pcmModeSave = ProSLIC_ReadReg(pProslic,11); /* PCMMODE */
|
| 682 |
|
| 683 |
|
| 684 | /* Disable PCM bus before changing format */
|
| 685 | regData = pTstin->pcmLpbkTest.pcmModeSave & ~0x10; /* PCM_EN = 0 */
|
| 686 | ProSLIC_WriteReg(pProslic,11,regData);
|
| 687 |
|
| 688 | /* Configure for either 8 or 16bit linear */
|
| 689 | if(pTstin->pcmLpbkTest.pcm8BitLinear == PCM_8BIT)
|
| 690 | {
|
| 691 | regData |= 0x02; /* PCM_FMT[1] = 1 */
|
| 692 | regData &= ~0x01; /* PCM_FMT[0] = 0 */
|
| 693 | }
|
| 694 | else /* PCM_16BIT */
|
| 695 | {
|
| 696 | regData |= 0x03; /* PCM_FMT[1:0] = 11 */
|
| 697 | }
|
| 698 |
|
| 699 | ProSLIC_WriteReg(pProslic,11,regData);
|
| 700 |
|
| 701 | /* Enable PCM Loopback */
|
| 702 | ProSLIC_WriteReg(pProslic,43,0x01); /* LOOPBACK */
|
| 703 |
|
| 704 | /* Re-enable PCM Bus */
|
| 705 | ProSLIC_WriteReg(pProslic,11,regData|0x10); /* PCMMODE */
|
| 706 |
|
| 707 | pTstin->pcmLpbkTest.pcmLpbkEnabled = 1;
|
| 708 | DEBUG_PRINT(pProslic, "ProSLIC : TestIn : pcmLpbk : ENABLED\n");
|
| 709 | return RC_NONE;
|
| 710 | }
|
| 711 |
|
| 712 | /* *********************************** */
|
| 713 | int ProSLIC_testInPCMLpbkDisable(proslicChanType *pProslic,
|
| 714 | proslicTestInObjType *pTstin)
|
| 715 | {
|
| 716 | uInt8 regData;
|
| 717 |
|
| 718 | /* Valid device check */
|
| 719 | if(TSTIN_INVALID_PART_NUM)
|
| 720 | {
|
| 721 | return RC_UNSUPPORTED_FEATURE;
|
| 722 | }
|
| 723 |
|
| 724 | /* Check if enabled */
|
| 725 | if(!pTstin->pcmLpbkTest.testEnable)
|
| 726 | {
|
| 727 | return RC_TEST_DISABLED;
|
| 728 | }
|
| 729 |
|
| 730 | /* Return if already disabled */
|
| 731 | if(!pTstin->pcmLpbkTest.pcmLpbkEnabled)
|
| 732 | {
|
| 733 | return RC_NONE;
|
| 734 | }
|
| 735 |
|
| 736 | /* Disable PCM Bus */
|
| 737 | regData = ProSLIC_ReadReg(pProslic,11); /* PCMMODE */
|
| 738 | ProSLIC_WriteReg(pProslic,11,regData &= ~0x10);
|
| 739 |
|
| 740 | /* Disable PCM Loopback */
|
| 741 | ProSLIC_WriteReg(pProslic,43,0);
|
| 742 |
|
| 743 | /* Restore PCMMODE. Force disabled while changing format */
|
| 744 | ProSLIC_WriteReg(pProslic,11,pTstin->pcmLpbkTest.pcmModeSave &= ~0x10);
|
| 745 | ProSLIC_WriteReg(pProslic,11,pTstin->pcmLpbkTest.pcmModeSave);
|
| 746 |
|
| 747 | pTstin->pcmLpbkTest.pcmLpbkEnabled = 0;
|
| 748 | DEBUG_PRINT(pProslic, "ProSLIC : TestIn : pcmLpbk : DISABLED\n");
|
| 749 | return RC_NONE;
|
| 750 | }
|
| 751 |
|
| 752 | /* *************************************************** */
|
| 753 |
|
| 754 | int ProSLIC_testInDCFeed(proslicChanType *pProslic,
|
| 755 | proslicTestInObjType *pTstin)
|
| 756 | {
|
| 757 | uInt8 enhanceRegSave;
|
| 758 | proslicMonitorType monitor;
|
| 759 | ramData lcroffhk_save = 0;
|
| 760 | ramData lcronhk_save = 0;
|
| 761 |
|
| 762 | /* Valid device check */
|
| 763 | if(TSTIN_INVALID_PART_NUM)
|
| 764 | {
|
| 765 | return RC_UNSUPPORTED_FEATURE;
|
| 766 | }
|
| 767 |
|
| 768 | /* Check if enabled */
|
| 769 | if(!pTstin->dcFeedTest.testEnable)
|
| 770 | {
|
| 771 | return RC_TEST_DISABLED;
|
| 772 | }
|
| 773 |
|
| 774 | /* Invalidate last test results */
|
| 775 | pTstin->dcFeedTest.testDataValid = TSTIN_RESULTS_INVALID;
|
| 776 |
|
| 777 | /* Verify line not in use */
|
| 778 | if(ProSLIC_ReadReg(pProslic,34) & 0x02) /* LCR */
|
| 779 | {
|
| 780 | DEBUG_PRINT(pProslic, "\nProSLIC : TestIn : DC Feed : Line in Use\n");
|
| 781 |
|
| 782 | if(pTstin->dcFeedTest.abortIfLineInUse==ABORT_LIU_ENABLED)
|
| 783 | {
|
| 784 | return RC_LINE_IN_USE;
|
| 785 | }
|
| 786 | }
|
| 787 |
|
| 788 | /* Disable Powersave */
|
| 789 | enhanceRegSave = ProSLIC_ReadReg(pProslic,47);
|
| 790 | ProSLIC_WriteReg(pProslic,47,0x20);
|
| 791 | Delay(pProTimer,10);
|
| 792 |
|
| 793 | /* Onhook measurement */
|
| 794 | ProSLIC_LineMonitor(pProslic,&monitor);
|
| 795 |
|
| 796 | pTstin->dcFeedTest.dcfeedVtipOnhook.value = monitor.vtip;
|
| 797 | pTstin->dcFeedTest.dcfeedVringOnhook.value = monitor.vring;
|
| 798 | pTstin->dcFeedTest.dcfeedVloopOnhook.value = monitor.vtr;
|
| 799 | pTstin->dcFeedTest.dcfeedVbatOnhook.value = monitor.vbat;
|
| 800 | pTstin->dcFeedTest.dcfeedItipOnhook.value = monitor.itip;
|
| 801 | pTstin->dcFeedTest.dcfeedIringOnhook.value = monitor.iring;
|
| 802 | pTstin->dcFeedTest.dcfeedIloopOnhook.value = monitor.itr;
|
| 803 | pTstin->dcFeedTest.dcfeedIlongOnhook.value = monitor.ilong;
|
| 804 |
|
| 805 | /* Modify LCR threshold (optional) before connecting test load */
|
| 806 | if(pTstin->dcFeedTest.applyLcrThresh == LCR_CHECK_ENABLED)
|
| 807 | {
|
| 808 | lcroffhk_save = ProSLIC_ReadRAM(pProslic,852);
|
| 809 | lcronhk_save = ProSLIC_ReadRAM(pProslic,853);
|
| 810 | ProSLIC_WriteRAM(pProslic,852,pTstin->dcFeedTest.altLcrOffThresh);
|
| 811 | ProSLIC_WriteRAM(pProslic,853,pTstin->dcFeedTest.altLcrOnThresh);
|
| 812 | }
|
| 813 |
|
| 814 | /* Connect internal test load for 2nd dc feed i/v point */
|
| 815 | setInternalTestLoad(pProslic,1);
|
| 816 | Delay(pProTimer,50);
|
| 817 | /* Offhook measurement */
|
| 818 | ProSLIC_LineMonitor(pProslic,&monitor);
|
| 819 |
|
| 820 | pTstin->dcFeedTest.dcfeedVtipOffhook.value = monitor.vtip;
|
| 821 | pTstin->dcFeedTest.dcfeedVringOffhook.value = monitor.vring;
|
| 822 | pTstin->dcFeedTest.dcfeedVloopOffhook.value = monitor.vtr;
|
| 823 | pTstin->dcFeedTest.dcfeedVbatOffhook.value = monitor.vbat;
|
| 824 | pTstin->dcFeedTest.dcfeedItipOffhook.value = monitor.itip;
|
| 825 | pTstin->dcFeedTest.dcfeedIringOffhook.value = monitor.iring;
|
| 826 | pTstin->dcFeedTest.dcfeedIloopOffhook.value = monitor.itr;
|
| 827 | pTstin->dcFeedTest.dcfeedIlongOffhook.value = monitor.ilong;
|
| 828 |
|
| 829 | pTstin->dcFeedTest.testResult = RC_TEST_PASSED; /* initialize */
|
| 830 | /* Read LCR */
|
| 831 | if(ProSLIC_ReadReg(pProslic,34) & 0x07) /* LCRRTP */
|
| 832 | {
|
| 833 | pTstin->dcFeedTest.lcrStatus = 1;
|
| 834 | }
|
| 835 | else
|
| 836 | {
|
| 837 | pTstin->dcFeedTest.lcrStatus = 0;
|
| 838 | }
|
| 839 |
|
| 840 | /* Only fail check if enabled */
|
| 841 | if(pTstin->dcFeedTest.applyLcrThresh == LCR_CHECK_ENABLED)
|
| 842 | {
|
| 843 | pTstin->dcFeedTest.testResult |= !pTstin->dcFeedTest.lcrStatus;
|
| 844 | }
|
| 845 |
|
| 846 | /* Disconnect Test Load */
|
| 847 | setInternalTestLoad(pProslic,0);
|
| 848 |
|
| 849 | /* Restore LCR thresholds */
|
| 850 | if(pTstin->dcFeedTest.applyLcrThresh == LCR_CHECK_ENABLED)
|
| 851 | {
|
| 852 | ProSLIC_WriteRAM(pProslic,852,lcroffhk_save);
|
| 853 | ProSLIC_WriteRAM(pProslic,853,lcronhk_save);
|
| 854 | }
|
| 855 |
|
| 856 | /* Restore enhance reg */
|
| 857 | ProSLIC_WriteReg(pProslic,47,enhanceRegSave);
|
| 858 |
|
| 859 | /* Process Results */
|
| 860 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 861 | &(pTstin->dcFeedTest.dcfeedVtipOnhook),"DcFeed : Vtip Onhook");
|
| 862 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 863 | &(pTstin->dcFeedTest.dcfeedVringOnhook),"DcFeed : Vring Onhook");
|
| 864 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 865 | &(pTstin->dcFeedTest.dcfeedVloopOnhook),"DcFeed : Vloop Onhook");
|
| 866 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 867 | &(pTstin->dcFeedTest.dcfeedVbatOnhook),"DcFeed : Vbat Onhook");
|
| 868 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 869 | &(pTstin->dcFeedTest.dcfeedItipOnhook),"DcFeed : Itip Onhook");
|
| 870 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 871 | &(pTstin->dcFeedTest.dcfeedIringOnhook),"DcFeed : Iring Onhook");
|
| 872 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 873 | &(pTstin->dcFeedTest.dcfeedIloopOnhook),"DcFeed : Iloop Onhook");
|
| 874 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 875 | &(pTstin->dcFeedTest.dcfeedIlongOnhook),"DcFeed : Ilong Onhook");
|
| 876 |
|
| 877 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 878 | &(pTstin->dcFeedTest.dcfeedVtipOffhook),"DcFeed : Vtip Offhook");
|
| 879 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 880 | &(pTstin->dcFeedTest.dcfeedVringOffhook),"DcFeed : Vring Offhook");
|
| 881 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 882 | &(pTstin->dcFeedTest.dcfeedVloopOffhook),"DcFeed : Vloop Offhook");
|
| 883 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 884 | &(pTstin->dcFeedTest.dcfeedVbatOffhook),"DcFeed : Vbat Offhook");
|
| 885 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 886 | &(pTstin->dcFeedTest.dcfeedItipOffhook),"DcFeed : Itip Offhook");
|
| 887 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 888 | &(pTstin->dcFeedTest.dcfeedIringOffhook),"DcFeed : Iring Offhook");
|
| 889 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 890 | &(pTstin->dcFeedTest.dcfeedIloopOffhook),"DcFeed : Iloop Offhook");
|
| 891 | pTstin->dcFeedTest.testResult |= logTest(pProslic,
|
| 892 | &(pTstin->dcFeedTest.dcfeedIlongOffhook),"DcFeed : Ilong Offhook");
|
| 893 |
|
| 894 | logStatus(pProslic,pTstin->dcFeedTest.lcrStatus,"DcFeed : LCR");
|
| 895 |
|
| 896 |
|
| 897 | pTstin->dcFeedTest.testDataValid = 1; /* New valid results */
|
| 898 |
|
| 899 | /* return cumulative pass/fail result */
|
| 900 |
|
| 901 | return (pTstin->dcFeedTest.testResult);
|
| 902 | }
|
| 903 |
|
| 904 | /* *********************************** */
|
| 905 | int ProSLIC_testInRinging(proslicChanType *pProslic,
|
| 906 | proslicTestInObjType *pTstin)
|
| 907 | {
|
| 908 | uInt8 ringcon_save,enhance_save;
|
| 909 | int32 vtr[MAX_RINGING_SAMPLES];
|
| 910 | int i;
|
| 911 | uInt8 lf;
|
| 912 | uInt32 rtper_save, ringfr_save,ringamp_save,ringof_save,rtacth_save,rtdcth_save;
|
| 913 | ProSLIC_DCfeed_Cfg dcfeedCfg[1];
|
| 914 |
|
| 915 | /* Valid device check */
|
| 916 | if(TSTIN_INVALID_PART_NUM)
|
| 917 | {
|
| 918 | return RC_UNSUPPORTED_FEATURE;
|
| 919 | }
|
| 920 |
|
| 921 | /* Check if enabled */
|
| 922 | if( (!pTstin->ringingTest.testEnable)
|
| 923 | || (pTstin->ringingTest.numSamples == 0) )
|
| 924 | {
|
| 925 | return RC_TEST_DISABLED;
|
| 926 | }
|
| 927 |
|
| 928 | /* Verify line not in use */
|
| 929 | if(ProSLIC_ReadReg(pProslic,34) & 0x02) /* LCR */
|
| 930 | {
|
| 931 | DEBUG_PRINT(pProslic, "\nProSLIC : TestIn : Ringing : Line in Use\n");
|
| 932 |
|
| 933 | if(pTstin->ringingTest.abortIfLineInUse)
|
| 934 | {
|
| 935 | return RC_LINE_IN_USE;
|
| 936 | }
|
| 937 | }
|
| 938 |
|
| 939 | /* Invalidate last test results */
|
| 940 | pTstin->ringingTest.testDataValid = TSTIN_RESULTS_INVALID;
|
| 941 |
|
| 942 | /* Check sample size/rate */
|
| 943 | if(pTstin->ringingTest.numSamples > MAX_RINGING_SAMPLES)
|
| 944 | {
|
| 945 | pTstin->ringingTest.numSamples = MAX_RINGING_SAMPLES;
|
| 946 | }
|
| 947 |
|
| 948 | if(pTstin->ringingTest.sampleInterval > MAX_RINGING_SAMPLE_INTERVAL)
|
| 949 | {
|
| 950 | pTstin->ringingTest.sampleInterval = MAX_RINGING_SAMPLE_INTERVAL;
|
| 951 | }
|
| 952 |
|
| 953 | if(pTstin->ringingTest.sampleInterval < MIN_RINGING_SAMPLE_INTERVAL)
|
| 954 | {
|
| 955 | pTstin->ringingTest.sampleInterval = MIN_RINGING_SAMPLE_INTERVAL;
|
| 956 | }
|
| 957 |
|
| 958 | /* Disable Powersave */
|
| 959 | enhance_save = ProSLIC_ReadReg(pProslic,47);
|
| 960 | ProSLIC_WriteReg(pProslic,47,0x20);
|
| 961 | Delay(pProTimer,10);
|
| 962 |
|
| 963 | /* Disable ring cadencing */
|
| 964 | ringcon_save = ProSLIC_ReadReg(pProslic,38); /* RINGCON */
|
| 965 | ProSLIC_WriteReg(pProslic,38,ringcon_save&0xE7); /* RINGCON */
|
| 966 |
|
| 967 | /* Must enter ringing through active state */
|
| 968 | lf = ProSLIC_ReadReg(pProslic,30); /* LINEFEED */
|
| 969 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 970 | Delay(pProTimer,20); /* settle */
|
| 971 |
|
| 972 | /* Start ringing */
|
| 973 | ProSLIC_SetLinefeedStatus(pProslic,LF_RINGING);
|
| 974 | Delay(pProTimer,500);
|
| 975 |
|
| 976 | /* Verify Ring Started */
|
| 977 | if(ProSLIC_ReadReg(pProslic,30) != 0x44)
|
| 978 | {
|
| 979 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 980 | ProSLIC_SetLinefeedStatus(pProslic,LF_OPEN);
|
| 981 | ProSLIC_WriteReg(pProslic,38,ringcon_save);
|
| 982 | ProSLIC_WriteReg(pProslic,47,enhance_save);
|
| 983 | ProSLIC_SetLinefeedStatus(pProslic,lf);
|
| 984 |
|
| 985 | DEBUG_PRINT(pProslic, "ProSLIC : TestIn : Ringing : Ring Start Fail\n");
|
| 986 |
|
| 987 | pTstin->ringingTest.testResult = RC_TEST_FAILED;
|
| 988 | return RC_RING_START_FAIL;
|
| 989 | }
|
| 990 |
|
| 991 | /* Capture samples */
|
| 992 | pTstin->ringingTest.ringingVdc.value = 0;
|
| 993 | for(i=0; i<pTstin->ringingTest.numSamples; i++)
|
| 994 | {
|
| 995 | vtr[i] = ProSLIC_ReadMADCScaled(pProslic,69,0); /* VDIFF_FILT */
|
| 996 | pTstin->ringingTest.ringingVdc.value += vtr[i];
|
| 997 |
|
| 998 | DEBUG_PRINT(pProslic, "ProSLIC : TestIn : Ringing : Vtr[%d] = %d\n",i, (int)(vtr[i]));
|
| 999 |
|
| 1000 | Delay(pProTimer,pTstin->ringingTest.sampleInterval);
|
| 1001 | }
|
| 1002 |
|
| 1003 | /* Restore linefeed */
|
| 1004 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 1005 | Delay(pProTimer,20);
|
| 1006 |
|
| 1007 | /* Process Results */
|
| 1008 | pTstin->ringingTest.ringingVdc.value /= pTstin->ringingTest.numSamples;
|
| 1009 | for(i=0; i<pTstin->ringingTest.numSamples; i++)
|
| 1010 | {
|
| 1011 | vtr[i] -= pTstin->ringingTest.ringingVdc.value;
|
| 1012 | pTstin->ringingTest.ringingVac.value += ((vtr[i]/100L) * (vtr[i]/100L));
|
| 1013 | }
|
| 1014 |
|
| 1015 |
|
| 1016 | pTstin->ringingTest.ringingVac.value /= pTstin->ringingTest.numSamples;
|
| 1017 | pTstin->ringingTest.ringingVac.value = Isqrt32(
|
| 1018 | pTstin->ringingTest.ringingVac.value);
|
| 1019 | pTstin->ringingTest.ringingVac.value *= 100L;
|
| 1020 |
|
| 1021 | pTstin->ringingTest.testResult = RC_TEST_PASSED;
|
| 1022 | pTstin->ringingTest.testResult |= logTest(pProslic,
|
| 1023 | &(pTstin->ringingTest.ringingVdc),"Ringing : VDC");
|
| 1024 | pTstin->ringingTest.testResult |= logTest(pProslic,
|
| 1025 | &(pTstin->ringingTest.ringingVac),"Ringing : VAC");
|
| 1026 | /*
|
| 1027 | ** Optional Ringtrip Test
|
| 1028 | */
|
| 1029 |
|
| 1030 | if(pTstin->ringingTest.ringtripTestEnable == RTP_CHECK_ENABLED)
|
| 1031 | {
|
| 1032 | /* Setup low voltage linefeed so low level ringing may be used */
|
| 1033 | ProSLIC_SetLinefeedStatus(pProslic,LF_OPEN);
|
| 1034 | storeDCFeedPreset(pProslic,&(dcfeedCfg[0]),0);
|
| 1035 | ProSLIC_DCFeedSetupCfg(pProslic,&(ringtripTestDCFeedPreset[0]),0);
|
| 1036 |
|
| 1037 | /* Optional Ringtrip Test (modified ringer settings to use test load to trip) */
|
| 1038 | rtper_save = ProSLIC_ReadRAM(pProslic,755);
|
| 1039 | ringfr_save = ProSLIC_ReadRAM(pProslic,844);
|
| 1040 | ringamp_save = ProSLIC_ReadRAM(pProslic,845);
|
| 1041 | ringof_save = ProSLIC_ReadRAM(pProslic,843);
|
| 1042 | rtacth_save = ProSLIC_ReadRAM(pProslic,848);
|
| 1043 | rtdcth_save = ProSLIC_ReadRAM(pProslic,847);
|
| 1044 |
|
| 1045 | ProSLIC_WriteRAM(pProslic,755,0x50000L); /* RTPER */
|
| 1046 | ProSLIC_WriteRAM(pProslic,844,0x7EFE000L);/* RINGFR */
|
| 1047 | ProSLIC_WriteRAM(pProslic,845,0xD6307L); /* RINGAMP */
|
| 1048 | ProSLIC_WriteRAM(pProslic,843,0x0L); /* RINGOF */
|
| 1049 | ProSLIC_WriteRAM(pProslic,848,0x7827FL); /* RTACTH */
|
| 1050 | ProSLIC_WriteRAM(pProslic,847,0xFFFFFFFL);/* RTDCTH */
|
| 1051 |
|
| 1052 | /* Start ringing from active state */
|
| 1053 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 1054 | Delay(pProTimer,20);
|
| 1055 | ProSLIC_SetLinefeedStatus(pProslic,LF_RINGING);
|
| 1056 | Delay(pProTimer,200);
|
| 1057 |
|
| 1058 | /* Verify Ring Started */
|
| 1059 | if(ProSLIC_ReadReg(pProslic,30) != 0x44)
|
| 1060 | {
|
| 1061 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 1062 | ProSLIC_SetLinefeedStatus(pProslic,LF_OPEN);
|
| 1063 | ProSLIC_WriteReg(pProslic,38,ringcon_save);
|
| 1064 | ProSLIC_WriteReg(pProslic,47,enhance_save);
|
| 1065 |
|
| 1066 | /* Restore DC Feed */
|
| 1067 | ProSLIC_DCFeedSetupCfg(pProslic,&(dcfeedCfg[0]),0);
|
| 1068 |
|
| 1069 | /* Restore Ring Settings */
|
| 1070 | ProSLIC_WriteRAM(pProslic,755,rtper_save); /* RTPER */
|
| 1071 | ProSLIC_WriteRAM(pProslic,844,ringfr_save); /*RINGFR */
|
| 1072 | ProSLIC_WriteRAM(pProslic,845,ringamp_save); /* RINGAMP */
|
| 1073 | ProSLIC_WriteRAM(pProslic,843,ringof_save); /* RINGOF */
|
| 1074 | ProSLIC_WriteRAM(pProslic,848,rtacth_save); /* RTACTH */
|
| 1075 | ProSLIC_WriteRAM(pProslic,847,rtdcth_save); /* RTDCTH */
|
| 1076 |
|
| 1077 | ProSLIC_SetLinefeedStatus(pProslic,lf);
|
| 1078 |
|
| 1079 | DEBUG_PRINT(pProslic, "ProSLIC : TestIn : Ringtrip : Ring Start Fail\n");
|
| 1080 |
|
| 1081 | pTstin->ringingTest.testResult=RC_TEST_FAILED;
|
| 1082 | return RC_RING_START_FAIL;
|
| 1083 | }
|
| 1084 |
|
| 1085 | /* Connect Test Load to cause ringtrip */
|
| 1086 | setInternalTestLoad(pProslic,1);
|
| 1087 | Delay(pProTimer,200);
|
| 1088 |
|
| 1089 | /* Check for RTP */
|
| 1090 | if(ProSLIC_ReadReg(pProslic,34) & 0x01) /* LCRRTP */
|
| 1091 | {
|
| 1092 | pTstin->ringingTest.rtpStatus = 1;
|
| 1093 | pTstin->ringingTest.testResult |= RC_TEST_PASSED;
|
| 1094 | }
|
| 1095 | else
|
| 1096 | {
|
| 1097 | pTstin->ringingTest.rtpStatus = 0;
|
| 1098 | pTstin->ringingTest.testResult |= RC_TEST_FAILED;
|
| 1099 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 1100 | }
|
| 1101 | setInternalTestLoad(pProslic,0);
|
| 1102 | Delay(pProTimer,20);
|
| 1103 |
|
| 1104 | logStatus(pProslic,pTstin->ringingTest.rtpStatus,"Ringing : RTP");
|
| 1105 |
|
| 1106 | /* Restore DC Feed */
|
| 1107 | ProSLIC_DCFeedSetupCfg(pProslic,&(dcfeedCfg[0]),0);
|
| 1108 |
|
| 1109 | /* Restore Ring Settings */
|
| 1110 | ProSLIC_WriteRAM(pProslic,755,rtper_save);/* RTPER */
|
| 1111 | ProSLIC_WriteRAM(pProslic,844,ringfr_save);/*RINGFR */
|
| 1112 | ProSLIC_WriteRAM(pProslic,845,ringamp_save); /* RINGAMP */
|
| 1113 | ProSLIC_WriteRAM(pProslic,843,ringof_save); /* RINGOF */
|
| 1114 | ProSLIC_WriteRAM(pProslic,848,rtacth_save);/* RTACTH */
|
| 1115 | ProSLIC_WriteRAM(pProslic,847,rtdcth_save);/* RTDCTH */
|
| 1116 |
|
| 1117 | }/* end of ringtrip test */
|
| 1118 |
|
| 1119 | /* Restore Linefeed */
|
| 1120 | ProSLIC_SetLinefeedStatus(pProslic,lf);
|
| 1121 |
|
| 1122 | /* Restore RINGCON and ENHANCE */
|
| 1123 | ProSLIC_WriteReg(pProslic,38,ringcon_save);
|
| 1124 | ProSLIC_WriteReg(pProslic,47,enhance_save);
|
| 1125 |
|
| 1126 | pTstin->ringingTest.testDataValid = TSTIN_RESULTS_VALID;
|
| 1127 |
|
| 1128 | return (pTstin->ringingTest.testResult);
|
| 1129 | }
|
| 1130 |
|
| 1131 | /* *********************************** */
|
| 1132 | int ProSLIC_testInBattery(proslicChanType *pProslic,
|
| 1133 | proslicTestInObjType *pTstin)
|
| 1134 | {
|
| 1135 | proslicMonitorType monitor;
|
| 1136 |
|
| 1137 | /* Valid device check */
|
| 1138 | if(TSTIN_INVALID_PART_NUM)
|
| 1139 | {
|
| 1140 | return RC_UNSUPPORTED_FEATURE;
|
| 1141 | }
|
| 1142 |
|
| 1143 | /* Check if enabled */
|
| 1144 | if(!pTstin->batteryTest.testEnable)
|
| 1145 | {
|
| 1146 | return RC_TEST_DISABLED;
|
| 1147 | }
|
| 1148 |
|
| 1149 | /* Invalidate last test results */
|
| 1150 | pTstin->batteryTest.testDataValid = TSTIN_RESULTS_INVALID;
|
| 1151 |
|
| 1152 | /* Measure Battery */
|
| 1153 | ProSLIC_LineMonitor(pProslic,&monitor);
|
| 1154 |
|
| 1155 | pTstin->batteryTest.vbat.value = monitor.vbat;
|
| 1156 |
|
| 1157 | pTstin->batteryTest.testResult = logTest(pProslic,&(pTstin->batteryTest.vbat),
|
| 1158 | "Battery : VBAT");
|
| 1159 |
|
| 1160 | pTstin->batteryTest.testDataValid =
|
| 1161 | TSTIN_RESULTS_VALID; /* New valid results */
|
| 1162 |
|
| 1163 | return (pTstin->batteryTest.testResult);
|
| 1164 | }
|
| 1165 |
|
| 1166 | /* *********************************** */
|
| 1167 | int ProSLIC_testInAudio(proslicChanType *pProslic, proslicTestInObjType *pTstin)
|
| 1168 | {
|
| 1169 | uInt8 enhanceRegSave;
|
| 1170 | uInt8 lf;
|
| 1171 | int32 data;
|
| 1172 | int32 gainMeas1,gainMeas2;
|
| 1173 | int32 gainMeas3 = 0;
|
| 1174 | ProSLIC_audioGain_Cfg gainCfg;
|
| 1175 | int32 Pin = -3980; /* -10dBm + 6.02dB (since OHT w/ no AC load) */
|
| 1176 |
|
| 1177 | /* Valid device check */
|
| 1178 | if(TSTIN_INVALID_PART_NUM)
|
| 1179 | {
|
| 1180 | return RC_UNSUPPORTED_FEATURE;
|
| 1181 | }
|
| 1182 |
|
| 1183 | /* Check if enabled */
|
| 1184 | if(!pTstin->audioTest.testEnable)
|
| 1185 | {
|
| 1186 | return RC_TEST_DISABLED;
|
| 1187 | }
|
| 1188 |
|
| 1189 | /* Invalidate last test results */
|
| 1190 | pTstin->audioTest.testDataValid = TSTIN_RESULTS_INVALID;
|
| 1191 |
|
| 1192 | /* Verify line not in use */
|
| 1193 | if(ProSLIC_ReadReg(pProslic,34) & 0x02) /* LCR */
|
| 1194 | {
|
| 1195 | DEBUG_PRINT(pProslic, "\nProSLIC : TestIn : Audio : Line in Use\n");
|
| 1196 |
|
| 1197 | if(pTstin->audioTest.abortIfLineInUse == ABORT_LIU_ENABLED)
|
| 1198 | {
|
| 1199 | return RC_LINE_IN_USE;
|
| 1200 | }
|
| 1201 | }
|
| 1202 |
|
| 1203 | /* Disable Powersave */
|
| 1204 | enhanceRegSave = ProSLIC_ReadReg(pProslic,47);
|
| 1205 | ProSLIC_WriteReg(pProslic,47,0x20);
|
| 1206 | Delay(pProTimer,10);
|
| 1207 |
|
| 1208 |
|
| 1209 | /* Setup Audio Filter, enable audio in OHT */
|
| 1210 | lf = ProSLIC_ReadReg(pProslic,30); /* LINEFEED */
|
| 1211 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 1212 | Delay(pProTimer,20); /* settle */
|
| 1213 | setup1kHzBandpass(pProslic);
|
| 1214 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_OHT);
|
| 1215 |
|
| 1216 | /* Setup osc1 for 1kHz -10dBm tone, disable hybrid, enable filters */
|
| 1217 | ProSLIC_WriteRAM(pProslic,26,0x5A80000L); /* OSC1FREQ */
|
| 1218 | ProSLIC_WriteRAM(pProslic,27,0x5D8000L); /* OSC1AMP */
|
| 1219 | ProSLIC_WriteReg(pProslic,48,0x02); /* OMODE */
|
| 1220 | ProSLIC_WriteReg(pProslic,49,0x01); /* OCON */
|
| 1221 | ProSLIC_WriteReg(pProslic,44,0x10); /* DIGCON */
|
| 1222 | ProSLIC_WriteReg(pProslic,71,0x10); /* DIAG1 */
|
| 1223 |
|
| 1224 | /* Settle */
|
| 1225 | Delay(pProTimer,800);
|
| 1226 |
|
| 1227 | /* Read first gain measurement (Gtx + Grx + Gzadj) */
|
| 1228 | gainMeas1 = readAudioDiagLevel(pProslic,pTstin->audioTest.zerodBm_mVpk);
|
| 1229 |
|
| 1230 | /* Bypass TXACHPF and set TXACEQ to unity */
|
| 1231 | gainCfg.acgain = ProSLIC_ReadRAM(pProslic,544); /* TXACGAIN */
|
| 1232 | gainCfg.aceq_c0 = ProSLIC_ReadRAM(pProslic,540); /* TXACEQ_C0 */
|
| 1233 | gainCfg.aceq_c1 = ProSLIC_ReadRAM(pProslic,541); /* TXACEQ_C1 */
|
| 1234 | gainCfg.aceq_c2 = ProSLIC_ReadRAM(pProslic,542); /* TXACEQ_C2 */
|
| 1235 | gainCfg.aceq_c3 = ProSLIC_ReadRAM(pProslic,543); /* TXACEQ_C3 */
|
| 1236 | ProSLIC_WriteRAM(pProslic,544,0x8000000L);
|
| 1237 | ProSLIC_WriteRAM(pProslic,543,0x0L);
|
| 1238 | ProSLIC_WriteRAM(pProslic,542,0x0L);
|
| 1239 | ProSLIC_WriteRAM(pProslic,541,0x0L);
|
| 1240 | ProSLIC_WriteRAM(pProslic,540,0x8000000L);
|
| 1241 | ProSLIC_WriteReg(pProslic,44,0x18);
|
| 1242 |
|
| 1243 | /* Settle */
|
| 1244 | Delay(pProTimer,800);
|
| 1245 |
|
| 1246 | /* Read second level measurement (RX level only) */
|
| 1247 | gainMeas2 = readAudioDiagLevel(pProslic,pTstin->audioTest.zerodBm_mVpk);
|
| 1248 |
|
| 1249 | /* Adjust txgain if TXACGAIN wasn't unity during gainMeas1 */
|
| 1250 | if(gainCfg.acgain != 0x8000000L)
|
| 1251 | {
|
| 1252 | data = (gainCfg.acgain*10)/134217;
|
| 1253 | gainMeas3 = dBLookup(data);
|
| 1254 | }
|
| 1255 |
|
| 1256 | /* Computations */
|
| 1257 | pTstin->audioTest.rxGain.value = gainMeas2 - Pin;
|
| 1258 | pTstin->audioTest.txGain.value = gainMeas1 - gainMeas2 + gainMeas3;
|
| 1259 |
|
| 1260 | #ifdef ENABLE_DEBUG
|
| 1261 | if( DEBUG_ENABLED(pProslic) )
|
| 1262 | {
|
| 1263 | LOGPRINT("ProSLIC : TestIn : Audio : gainMeas1 = %d\n", (int)gainMeas1);
|
| 1264 | LOGPRINT("ProSLIC : TestIn : Audio : gainMeas2 = %d\n", (int)gainMeas2);
|
| 1265 | LOGPRINT("ProSLIC : TestIn : Audio : gainMeas3 = %d\n", (int)gainMeas3);
|
| 1266 | }
|
| 1267 | #endif
|
| 1268 | pTstin->audioTest.testResult = RC_TEST_PASSED;
|
| 1269 | pTstin->audioTest.testResult |= logTest(pProslic,&(pTstin->audioTest.rxGain),
|
| 1270 | "RX Path Gain");
|
| 1271 | pTstin->audioTest.testResult |= logTest(pProslic,&(pTstin->audioTest.txGain),
|
| 1272 | "TX Path Gain");
|
| 1273 |
|
| 1274 |
|
| 1275 |
|
| 1276 | /*
|
| 1277 | ** Restore
|
| 1278 | */
|
| 1279 |
|
| 1280 | /* Need to store/restore all modified reg/RAM */
|
| 1281 | ProSLIC_WriteRAM(pProslic,544,gainCfg.acgain);
|
| 1282 | ProSLIC_WriteRAM(pProslic,540,gainCfg.aceq_c0);
|
| 1283 | ProSLIC_WriteRAM(pProslic,541,gainCfg.aceq_c1);
|
| 1284 | ProSLIC_WriteRAM(pProslic,542,gainCfg.aceq_c2);
|
| 1285 | ProSLIC_WriteRAM(pProslic,543,gainCfg.aceq_c3);
|
| 1286 |
|
| 1287 | ProSLIC_WriteReg(pProslic,71,0x0); /* DIAG1 */
|
| 1288 | ProSLIC_WriteReg(pProslic,44,0x0); /* DIGCON */
|
| 1289 | ProSLIC_WriteReg(pProslic,48,0x0); /* OMODE */
|
| 1290 | ProSLIC_WriteReg(pProslic,49,0x0); /* OCON */
|
| 1291 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 1292 | ProSLIC_WriteReg(pProslic,47,enhanceRegSave);
|
| 1293 | ProSLIC_SetLinefeedStatus(pProslic,lf);
|
| 1294 |
|
| 1295 | /* Validate last test results */
|
| 1296 | pTstin->audioTest.testDataValid = TSTIN_RESULTS_VALID;
|
| 1297 |
|
| 1298 | return pTstin->audioTest.testResult;
|
| 1299 | }
|
| 1300 |
|
| 1301 |
|
| 1302 | /* *********************************** */
|
| 1303 |
|
| 1304 | int ProSLIC_testInPcmLpbkSetup(proslicTestInObjType *pTstin,
|
| 1305 | proslicPcmLpbkTest *pcmLpbkTest)
|
| 1306 | {
|
| 1307 | pTstin->pcmLpbkTest = *pcmLpbkTest;
|
| 1308 | pTstin->pcmLpbkTest.testEnable = 1;
|
| 1309 |
|
| 1310 | return RC_NONE;
|
| 1311 | }
|
| 1312 |
|
| 1313 | /* *********************************** */
|
| 1314 |
|
| 1315 | int ProSLIC_testInDcFeedSetup(proslicTestInObjType *pTstin,
|
| 1316 | proslicDcFeedTest *dcFeedTest)
|
| 1317 | {
|
| 1318 | pTstin->dcFeedTest = *dcFeedTest;
|
| 1319 | pTstin->dcFeedTest.testEnable = 1;
|
| 1320 |
|
| 1321 | return RC_NONE;
|
| 1322 | }
|
| 1323 |
|
| 1324 | /* *********************************** */
|
| 1325 |
|
| 1326 | int ProSLIC_testInRingingSetup(proslicTestInObjType *pTstin,
|
| 1327 | proslicRingingTest *ringingTest)
|
| 1328 | {
|
| 1329 | /* Copy limits per-channel */
|
| 1330 |
|
| 1331 | pTstin->ringingTest = *ringingTest;
|
| 1332 | pTstin->ringingTest.testEnable = 1;
|
| 1333 |
|
| 1334 | return RC_NONE;
|
| 1335 | }
|
| 1336 | /* *********************************** */
|
| 1337 |
|
| 1338 | int ProSLIC_testInBatterySetup(proslicTestInObjType *pTstin,
|
| 1339 | proslicBatteryTest *batteryTest)
|
| 1340 | {
|
| 1341 | /* Copy limits per-channel */
|
| 1342 |
|
| 1343 | pTstin->batteryTest = *batteryTest;
|
| 1344 | pTstin->batteryTest.testEnable = 1;
|
| 1345 |
|
| 1346 | return RC_NONE;
|
| 1347 | }
|
| 1348 |
|
| 1349 | /* *********************************** */
|
| 1350 |
|
| 1351 | int ProSLIC_testInAudioSetup(proslicTestInObjType *pTstin,
|
| 1352 | proslicAudioTest *audioTest)
|
| 1353 | {
|
| 1354 | /* Copy limits per-channel */
|
| 1355 |
|
| 1356 | pTstin->audioTest = *audioTest;
|
| 1357 | pTstin->audioTest.testEnable = 1;
|
| 1358 |
|
| 1359 | return RC_NONE;
|
| 1360 | }
|
| 1361 |
|
| 1362 |
|
| 1363 | /* *********************************** */
|
| 1364 | int ProSLIC_testInPrintLimits(proslicChanType *pProslic,
|
| 1365 | proslicTestInObjType *pTstin)
|
| 1366 | {
|
| 1367 | /* Valid device check */
|
| 1368 | if(TSTIN_INVALID_PART_NUM)
|
| 1369 | {
|
| 1370 | return RC_UNSUPPORTED_FEATURE;
|
| 1371 | }
|
| 1372 | #ifdef ENABLE_DEBUG
|
| 1373 | if( DEBUG_ENABLED(pProslic ) )
|
| 1374 | {
|
| 1375 | LOGPRINT("\n");
|
| 1376 | LOGPRINT("************ Test-In Test Limits **************\n");
|
| 1377 | LOGPRINT("----------------------------------------------------------------\n");
|
| 1378 | LOGPRINT("ProSLIC : Test-In : Limits : vtip_on_min (mv) = %d\n",
|
| 1379 | (int)(pTstin->dcFeedTest.dcfeedVtipOnhook.lowerLimit));
|
| 1380 | LOGPRINT("ProSLIC : Test-In : Limits : vtip_on_max (mv) = %d\n",
|
| 1381 | (int)(pTstin->dcFeedTest.dcfeedVtipOnhook.upperLimit));
|
| 1382 | LOGPRINT("ProSLIC : Test-In : Limits : vring_on_min (mv) = %d\n",
|
| 1383 | (int)(pTstin->dcFeedTest.dcfeedVringOnhook.lowerLimit));
|
| 1384 | LOGPRINT("ProSLIC : Test-In : Limits : vring_on_max (mv) = %d\n",
|
| 1385 | (int)(pTstin->dcFeedTest.dcfeedVringOnhook.upperLimit));
|
| 1386 | LOGPRINT("ProSLIC : Test-In : Limits : vloop_on_min (mv) = %d\n",
|
| 1387 | (int)(pTstin->dcFeedTest.dcfeedVloopOnhook.lowerLimit));
|
| 1388 | LOGPRINT("ProSLIC : Test-In : Limits : vloop_on_max (mv) = %d\n",
|
| 1389 | (int)(pTstin->dcFeedTest.dcfeedVloopOnhook.upperLimit));
|
| 1390 | LOGPRINT("ProSLIC : Test-In : Limits : vbat_on_min (mv) = %d\n",
|
| 1391 | (int)(pTstin->dcFeedTest.dcfeedVbatOnhook.lowerLimit));
|
| 1392 | LOGPRINT("ProSLIC : Test-In : Limits : vbat_on_max (mv) = %d\n",
|
| 1393 | (int)(pTstin->dcFeedTest.dcfeedVbatOnhook.upperLimit));
|
| 1394 | LOGPRINT("ProSLIC : Test-In : Limits : itip_on_min (ua) = %d\n",
|
| 1395 | (int)(pTstin->dcFeedTest.dcfeedItipOnhook.lowerLimit));
|
| 1396 | LOGPRINT("ProSLIC : Test-In : Limits : itip_on_max (ua) = %d\n",
|
| 1397 | (int)(pTstin->dcFeedTest.dcfeedItipOnhook.upperLimit));
|
| 1398 | LOGPRINT("ProSLIC : Test-In : Limits : iring_on_min (ua) = %d\n",
|
| 1399 | (int)(pTstin->dcFeedTest.dcfeedIringOnhook.lowerLimit));
|
| 1400 | LOGPRINT("ProSLIC : Test-In : Limits : iring_on_max (ua) = %d\n",
|
| 1401 | (int)(pTstin->dcFeedTest.dcfeedIringOnhook.upperLimit));
|
| 1402 | LOGPRINT("ProSLIC : Test-In : Limits : iloop_on_min (ua) = %d\n",
|
| 1403 | (int)(pTstin->dcFeedTest.dcfeedIloopOnhook.lowerLimit));
|
| 1404 | LOGPRINT("ProSLIC : Test-In : Limits : iloop_on_max (ua) = %d\n",
|
| 1405 | (int)(pTstin->dcFeedTest.dcfeedIloopOnhook.upperLimit));
|
| 1406 | LOGPRINT("ProSLIC : Test-In : Limits : ilong_on_min (ua) = %d\n",
|
| 1407 | (int)(pTstin->dcFeedTest.dcfeedIlongOnhook.lowerLimit));
|
| 1408 | LOGPRINT("ProSLIC : Test-In : Limits : ilong_on_max (ua) = %d\n",
|
| 1409 | (int)(pTstin->dcFeedTest.dcfeedIlongOnhook.upperLimit));
|
| 1410 | LOGPRINT("----------------------------------------------------------------\n");
|
| 1411 | LOGPRINT("ProSLIC : Test-In : Limits : vtip_off_min (mv) = %d\n",
|
| 1412 | (int)(pTstin->dcFeedTest.dcfeedVtipOffhook.lowerLimit));
|
| 1413 | LOGPRINT("ProSLIC : Test-In : Limits : vtip_off_max (mv) = %d\n",
|
| 1414 | (int)(pTstin->dcFeedTest.dcfeedVtipOffhook.upperLimit));
|
| 1415 | LOGPRINT("ProSLIC : Test-In : Limits : vring_off_min (mv) = %d\n",
|
| 1416 | (int)(pTstin->dcFeedTest.dcfeedVringOffhook.lowerLimit));
|
| 1417 | LOGPRINT("ProSLIC : Test-In : Limits : vring_off_max (mv) = %d\n",
|
| 1418 | (int)(pTstin->dcFeedTest.dcfeedVringOffhook.upperLimit));
|
| 1419 | LOGPRINT("ProSLIC : Test-In : Limits : vloop_off_min (mv) = %d\n",
|
| 1420 | (int)(pTstin->dcFeedTest.dcfeedVloopOffhook.lowerLimit));
|
| 1421 | LOGPRINT("ProSLIC : Test-In : Limits : vloop_off_max (mv) = %d\n",
|
| 1422 | (int)(pTstin->dcFeedTest.dcfeedVloopOffhook.upperLimit));
|
| 1423 | LOGPRINT("ProSLIC : Test-In : Limits : vbat_off_min (mv) = %d\n",
|
| 1424 | (int)(pTstin->dcFeedTest.dcfeedVbatOffhook.lowerLimit));
|
| 1425 | LOGPRINT("ProSLIC : Test-In : Limits : vbat_off_max (mv) = %d\n",
|
| 1426 | (int)(pTstin->dcFeedTest.dcfeedVbatOffhook.upperLimit));
|
| 1427 | LOGPRINT("ProSLIC : Test-In : Limits : itip_off_min (ua) = %d\n",
|
| 1428 | (int)(pTstin->dcFeedTest.dcfeedItipOffhook.lowerLimit));
|
| 1429 | LOGPRINT("ProSLIC : Test-In : Limits : itip_off_max (ua) = %d\n",
|
| 1430 | (int)(pTstin->dcFeedTest.dcfeedItipOffhook.upperLimit));
|
| 1431 | LOGPRINT("ProSLIC : Test-In : Limits : iring_off_min (ua) = %d\n",
|
| 1432 | (int)(pTstin->dcFeedTest.dcfeedIringOffhook.lowerLimit));
|
| 1433 | LOGPRINT("ProSLIC : Test-In : Limits : iring_off_max (ua) = %d\n",
|
| 1434 | (int)(pTstin->dcFeedTest.dcfeedIringOffhook.upperLimit));
|
| 1435 | LOGPRINT("ProSLIC : Test-In : Limits : iloop_off_min (ua) = %d\n",
|
| 1436 | (int)(pTstin->dcFeedTest.dcfeedIloopOffhook.lowerLimit));
|
| 1437 | LOGPRINT("ProSLIC : Test-In : Limits : iloop_off_max (ua) = %d\n",
|
| 1438 | (int)(pTstin->dcFeedTest.dcfeedIloopOffhook.upperLimit));
|
| 1439 | LOGPRINT("ProSLIC : Test-In : Limits : ilong_off_min (ua) = %d\n",
|
| 1440 | (int)(pTstin->dcFeedTest.dcfeedIlongOffhook.lowerLimit));
|
| 1441 | LOGPRINT("ProSLIC : Test-In : Limits : ilong_off_max (ua) = %d\n",
|
| 1442 | (int)(pTstin->dcFeedTest.dcfeedIlongOffhook.upperLimit));
|
| 1443 | LOGPRINT("----------------------------------------------------------------\n");
|
| 1444 | LOGPRINT("ProSLIC : Test-In : Limits : ringing_vac_min (mv) = %d\n",
|
| 1445 | (int)(pTstin->ringingTest.ringingVac.lowerLimit));
|
| 1446 | LOGPRINT("ProSLIC : Test-In : Limits : ringing_vac_max (mv) = %d\n",
|
| 1447 | (int)(pTstin->ringingTest.ringingVac.upperLimit));
|
| 1448 | LOGPRINT("ProSLIC : Test-In : Limits : ringing_vdc_min (mv) = %d\n",
|
| 1449 | (int)(pTstin->ringingTest.ringingVdc.lowerLimit));
|
| 1450 | LOGPRINT("ProSLIC : Test-In : Limits : ringing_vdc_max (mv) = %d\n",
|
| 1451 | (int)(pTstin->ringingTest.ringingVdc.upperLimit));
|
| 1452 | LOGPRINT("----------------------------------------------------------------\n");
|
| 1453 | LOGPRINT("ProSLIC : Test-In : Limits : battery_vbat_min (mv) = %d\n",
|
| 1454 | (int)(pTstin->batteryTest.vbat.lowerLimit));
|
| 1455 | LOGPRINT("ProSLIC : Test-In : Limits : battery_vbat_max (mv) = %d\n",
|
| 1456 | (int)(pTstin->batteryTest.vbat.upperLimit));
|
| 1457 | LOGPRINT("----------------------------------------------------------------\n");
|
| 1458 | LOGPRINT("ProSLIC : Test-In : Limits : audio_txgain_min (mdB) = %d\n",
|
| 1459 | (int)(pTstin->audioTest.txGain.lowerLimit));
|
| 1460 | LOGPRINT("ProSLIC : Test-In : Limits : audio_txgain_max (mdB) = %d\n",
|
| 1461 | (int)(pTstin->audioTest.txGain.upperLimit));
|
| 1462 | LOGPRINT("ProSLIC : Test-In : Limits : audio_rxgain_min (mdB) = %d\n",
|
| 1463 | (int)(pTstin->audioTest.rxGain.lowerLimit));
|
| 1464 | LOGPRINT("ProSLIC : Test-In : Limits : audio_rxgain_max (mdB) = %d\n",
|
| 1465 | (int)(pTstin->audioTest.rxGain.upperLimit));
|
| 1466 | LOGPRINT("----------------------------------------------------------------\n");
|
| 1467 | LOGPRINT("\n");
|
| 1468 | }
|
| 1469 | #else
|
| 1470 | SILABS_UNREFERENCED_PARAMETER(pTstin);
|
| 1471 | #endif
|
| 1472 | return RC_NONE;
|
| 1473 | }
|
| 1474 |
|
| 1475 |
|
| 1476 | static ProSLIC_DCfeed_Cfg testLoad_DC_Cfg[] =
|
| 1477 | {
|
| 1478 | {
|
| 1479 | 0x1DC6E1D3L, /* SLOPE_VLIM */
|
| 1480 | 0x1F909679L, /* SLOPE_RFEED */
|
| 1481 | 0x0040A0E0L, /* SLOPE_ILIM */
|
| 1482 | 0x1B8687BBL, /* SLOPE_DELTA1 */
|
| 1483 | 0x1CC4B75DL, /* SLOPE_DELTA2 */
|
| 1484 | 0x05A38633L, /* V_VLIM (48.000 v) */
|
| 1485 | 0x050D2839L, /* V_RFEED (43.000 v) */
|
| 1486 | 0x03FE7F0FL, /* V_ILIM (34.000 v) */
|
| 1487 | 0x009DAFD9L, /* CONST_RFEED (10.000 mA) */
|
| 1488 | 0x0045CBBCL, /* CONST_ILIM (15.000 mA) */
|
| 1489 | 0x002D8D96L, /* I_VLIM (0.000 mA) */
|
| 1490 | 0x005B0AFBL, /* LCRONHK (10.000 mA) */
|
| 1491 | 0x006D4060L, /* LCROFFHK (12.000 mA) */
|
| 1492 | 0x00008000L, /* LCRDBI (5.000 ms) */
|
| 1493 | 0x0048D595L, /* LONGHITH (8.000 mA) */
|
| 1494 | 0x003FBAE2L, /* LONGLOTH (7.000 mA) */
|
| 1495 | 0x00008000L, /* LONGDBI (5.000 ms) */
|
| 1496 | 0x000F0000L, /* LCRMASK (150.000 ms) */
|
| 1497 | 0x00080000L, /* LCRMASK_POLREV (80.000 ms) */
|
| 1498 | 0x00140000L, /* LCRMASK_STATE (200.000 ms) */
|
| 1499 | 0x00140000L, /* LCRMASK_LINECAP (200.000 ms) */
|
| 1500 | 0x01BA5E35L, /* VCM_OH (27.000 v) */
|
| 1501 | 0x0051EB85L, /* VOV_BAT (5.000 v) */
|
| 1502 | 0x00418937L, /* VOV_GND (4.000 v) */
|
| 1503 | }
|
| 1504 | };
|
| 1505 |
|
| 1506 | /* *********************************** */
|
| 1507 | int ProSLIC_testLoadTest(
|
| 1508 | SiVoiceChanType_ptr pProslic,
|
| 1509 | BOOLEAN is_testStart,
|
| 1510 | uint32_t timeDelayMsec)
|
| 1511 | {
|
| 1512 | static ProSLIC_DCfeed_Cfg dcfeedCfg;
|
| 1513 | static uInt8 digcon_reg_cache;
|
| 1514 |
|
| 1515 | TRACEPRINT(pProslic, " channel: %u is_testStart: %u delay = %u",
|
| 1516 | pProslic->channel,
|
| 1517 | is_testStart,
|
| 1518 | timeOffhookMsec);
|
| 1519 | /* Valid device check */
|
| 1520 |
|
| 1521 | if(TSTIN_INVALID_PART_NUM)
|
| 1522 | {
|
| 1523 | return RC_UNSUPPORTED_FEATURE;
|
| 1524 | }
|
| 1525 |
|
| 1526 | if( TRUE == is_testStart )
|
| 1527 | {
|
| 1528 | /* Verify line not in use */
|
| 1529 | if(ProSLIC_ReadReg(pProslic,PROSLIC_REG_LCRRTP) & 0x02) /* LCR */
|
| 1530 | {
|
| 1531 | DEBUG_PRINT(pProslic, "\nLine in Use: %u.\n", pProslic->channel);
|
| 1532 | return RC_LINE_IN_USE;
|
| 1533 | }
|
| 1534 |
|
| 1535 | /* Setup lower ILIM linefeed */
|
| 1536 | ProSLIC_SetLinefeedStatus(pProslic,LF_OPEN);
|
| 1537 | storeDCFeedPreset(pProslic, &dcfeedCfg, 0);
|
| 1538 |
|
| 1539 | ProSLIC_DCFeedSetupCfg( pProslic, testLoad_DC_Cfg, 0 );
|
| 1540 |
|
| 1541 | ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
|
| 1542 | Delay(pProTimer,100);
|
| 1543 |
|
| 1544 | /* Connect Test Load to cause LCR interrupt*/
|
| 1545 | setInternalTestLoad(pProslic,1);
|
| 1546 | Delay(pProTimer, timeDelayMsec);
|
| 1547 | DEBUG_PRINT(pProslic, "\n%s: test load on for channel %u\n",
|
| 1548 | __FUNCTION__, pProslic->channel);
|
| 1549 |
|
| 1550 | /* Disable hybrid circuit for test load loopback */
|
| 1551 | digcon_reg_cache = ProSLIC_ReadReg(pProslic,PROSLIC_REG_DIGCON);
|
| 1552 |
|
| 1553 | ProSLIC_WriteReg(pProslic, PROSLIC_REG_DIGCON,
|
| 1554 | digcon_reg_cache |0x10 );
|
| 1555 |
|
| 1556 | /* At this point the test load should of caused a LCR interrupt and
|
| 1557 | there is an audio path available. NOTE: there may be some distortion
|
| 1558 | of the audio...
|
| 1559 | */
|
| 1560 |
|
| 1561 | }
|
| 1562 | else
|
| 1563 | {
|
| 1564 | /* Restore hybrid circuit */
|
| 1565 | ProSLIC_WriteReg(pProslic,
|
| 1566 | PROSLIC_REG_DIGCON, digcon_reg_cache );
|
| 1567 |
|
| 1568 | /* Disconnect Test Load */
|
| 1569 | setInternalTestLoad(pProslic,0);
|
| 1570 | Delay(pProTimer, timeDelayMsec);
|
| 1571 | DEBUG_PRINT(pProslic, "\n%s: test load off for channel %u.\n",
|
| 1572 | __FUNCTION__, pProslic->channel);
|
| 1573 |
|
| 1574 | /* Restore DC Feed */
|
| 1575 | ProSLIC_DCFeedSetupCfg(pProslic, &dcfeedCfg, 0);
|
| 1576 | }
|
| 1577 |
|
| 1578 | return RC_NONE;
|
| 1579 | }
|
| 1580 |
|