| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | /*
|
| 2 | ** Copyright (c) 2011-2016 by Silicon Laboratories
|
| 3 | ** $Id: proslic_tstin.h 5419 2016-01-13 00:40:56Z nizajerk $
|
| 4 | **
|
| 5 | ** Author(s):
|
| 6 | ** cdp
|
| 7 | **
|
| 8 | ** Distributed by:
|
| 9 | ** Silicon Laboratories, Inc
|
| 10 | **
|
| 11 | ** This file contains proprietary information.
|
| 12 | ** No dissemination allowed without prior written permission from
|
| 13 | ** Silicon Laboratories, Inc.
|
| 14 | **
|
| 15 | ** File Description:
|
| 16 | ** This is the header file for the inward test implementations.
|
| 17 | **
|
| 18 | */
|
| 19 | #ifndef PROSLIC_TSTIN_H
|
| 20 | #define PROSLIC_TSTIN_H
|
| 21 |
|
| 22 | #include "si_voice_datatypes.h"
|
| 23 | #include "proslic.h"
|
| 24 |
|
| 25 | /** @addtogroup DIAGNOSTICS
|
| 26 | * @{
|
| 27 | */
|
| 28 | /** @defgroup PROSLIC_TSTIN ProSLIC Inward Tests (Test-In)
|
| 29 | * This section documents functions and data structures related to the
|
| 30 | * ProSLIC/FXS inward test implementations.
|
| 31 | * @{
|
| 32 | */
|
| 33 |
|
| 34 | #define MIN_RINGING_SAMPLES 16 /**< Minimum number of ringing samples for measuring ring amplitude */
|
| 35 | #define MAX_RINGING_SAMPLES 255 /**< Maximum number of ringing samples for measuring ring amplitude */
|
| 36 | #define MIN_RINGING_SAMPLE_INTERVAL 1 /**< Minimum sample interval for measuring ring amplitude */
|
| 37 | #define MAX_RINGING_SAMPLE_INTERVAL 10 /**< Maximum sample interval for measuring ring amplitude */
|
| 38 |
|
| 39 | /**
|
| 40 | * Test-In results status
|
| 41 | */
|
| 42 | enum
|
| 43 | {
|
| 44 | TSTIN_RESULTS_INVALID,
|
| 45 | TSTIN_RESULTS_VALID
|
| 46 | };
|
| 47 |
|
| 48 | /**
|
| 49 | * PCM format options
|
| 50 | */
|
| 51 | enum
|
| 52 | {
|
| 53 | PCM_8BIT,
|
| 54 | PCM_16BIT
|
| 55 | };
|
| 56 |
|
| 57 | /**
|
| 58 | * Abort if Line-in-use option
|
| 59 | */
|
| 60 | enum
|
| 61 | {
|
| 62 | ABORT_LIU_DISABLED,
|
| 63 | ABORT_LIU_ENABLED
|
| 64 | };
|
| 65 |
|
| 66 | /**
|
| 67 | * Check for loop closure option
|
| 68 | */
|
| 69 | enum
|
| 70 | {
|
| 71 | LCR_CHECK_DISABLED,
|
| 72 | LCR_CHECK_ENABLED
|
| 73 | };
|
| 74 |
|
| 75 | /**
|
| 76 | * Check for ringtrip option
|
| 77 | */
|
| 78 | enum
|
| 79 | {
|
| 80 | RTP_CHECK_DISABLED,
|
| 81 | RTP_CHECK_ENABLED
|
| 82 | };
|
| 83 |
|
| 84 |
|
| 85 | /**
|
| 86 | * Defines generic test limit/value/status structure
|
| 87 | */
|
| 88 | typedef struct
|
| 89 | {
|
| 90 | int32 lowerLimit; /**< Lower test limit */
|
| 91 | int32 upperLimit; /**< Upper test limit */
|
| 92 | int32 value; /**< Numeric test result */
|
| 93 | uInt8 testResult; /**< 0 - Fail, 1 - pass */
|
| 94 | } proslicTestObj;
|
| 95 |
|
| 96 | /**
|
| 97 | * Defines structure for PCM Loopback Test
|
| 98 | */
|
| 99 | typedef struct
|
| 100 | {
|
| 101 | BOOLEAN testEnable; /**< Gate execution/updating of results with this flag */
|
| 102 | BOOLEAN pcmLpbkEnabled; /**< Indicates if test data is valid (1) or stale (0) */
|
| 103 | BOOLEAN pcm8BitLinear; /**< Set to use 8 bit linear mode (used if normally using ulaw or alaw) */
|
| 104 | uInt8 pcmModeSave; /**< Store entry PCMMODE value */
|
| 105 | uInt8 testResult; /**< OR of all test results in this structure */
|
| 106 | } proslicPcmLpbkTest;
|
| 107 |
|
| 108 |
|
| 109 | /**
|
| 110 | * Defines structure for DC Feed Test
|
| 111 | */
|
| 112 | typedef struct
|
| 113 | {
|
| 114 | BOOLEAN testEnable; /**< Gate execution/updating of results with this flag */
|
| 115 | BOOLEAN testDataValid; /**< Indicates if test data is valid (1) or stale (0) */
|
| 116 | BOOLEAN abortIfLineInUse; /**< Abort test if LCR set at the start of test. Leaves results invalid */
|
| 117 | BOOLEAN applyLcrThresh; /**< Apply alternate LCR thresholds to ensure LCR event occurs */
|
| 118 | uInt32
|
| 119 | altLcrOffThresh; /**< Optional LCROFFHK threshold to apply during test */
|
| 120 | uInt32 altLcrOnThresh; /**< Optional LCRONHK threshold to apply during test */
|
| 121 | BOOLEAN lcrStatus; /**< Indicates LCR status after applying test load */
|
| 122 | proslicTestObj dcfeedVtipOnhook; /**< On-hook VTIP test results */
|
| 123 | proslicTestObj dcfeedVringOnhook; /**< On-hook VRING test results */
|
| 124 | proslicTestObj dcfeedVloopOnhook; /**< On-hook VLOOP test results */
|
| 125 | proslicTestObj dcfeedVbatOnhook; /**< On-hook VBAT test results */
|
| 126 | proslicTestObj dcfeedItipOnhook; /**< On-hook ITIP test results */
|
| 127 | proslicTestObj dcfeedIringOnhook; /**< On-hook IRING test results */
|
| 128 | proslicTestObj dcfeedIloopOnhook; /**< On-hook ILOOP test results */
|
| 129 | proslicTestObj dcfeedIlongOnhook; /**< On-hook ILONG test results */
|
| 130 | proslicTestObj dcfeedVtipOffhook; /**< Off-hook VTIP test results */
|
| 131 | proslicTestObj dcfeedVringOffhook; /**< Off-hook VRING test results */
|
| 132 | proslicTestObj dcfeedVloopOffhook; /**< Off-hook VLOOP test results */
|
| 133 | proslicTestObj dcfeedVbatOffhook; /**< Off-hook VBAT test results */
|
| 134 | proslicTestObj dcfeedItipOffhook; /**< Off-hook ITIP test results */
|
| 135 | proslicTestObj dcfeedIringOffhook; /**< Off-hook IRING test results */
|
| 136 | proslicTestObj dcfeedIloopOffhook; /**< Off-hook ILOOP test results */
|
| 137 | proslicTestObj dcfeedIlongOffhook; /**< Off-hook ILONG test results */
|
| 138 | uInt8 testResult; /**< OR of all test results in this structure */
|
| 139 | } proslicDcFeedTest;
|
| 140 |
|
| 141 |
|
| 142 | /**
|
| 143 | * Defines structure for Ringing Test
|
| 144 | */
|
| 145 | typedef struct
|
| 146 | {
|
| 147 | BOOLEAN testEnable; /**< Gate execution/updating of results with this flag */
|
| 148 | BOOLEAN testDataValid; /**< Indicates if test data is valid (1) or stale (0) */
|
| 149 | BOOLEAN abortIfLineInUse; /**< Abort test if LCR set at the start of test. Leaves results invalid */
|
| 150 | uInt16 numSamples; /**< Number of samples taken */
|
| 151 | uInt8
|
| 152 | sampleInterval; /**< Sample interval (in ms - range 1 to 100) */
|
| 153 | BOOLEAN ringtripTestEnable; /**< Enable ringtrip test */
|
| 154 | BOOLEAN rtpStatus; /**< RTP Bit */
|
| 155 | proslicTestObj ringingVac; /**< Ringing AC Voltage test results */
|
| 156 | proslicTestObj ringingVdc; /**< Ringing DC Voltage test results */
|
| 157 | uInt8 testResult; /**< OR of all test results in this structure */
|
| 158 | } proslicRingingTest;
|
| 159 |
|
| 160 | /**
|
| 161 | * Defines structure for Battery Test
|
| 162 | */
|
| 163 | typedef struct
|
| 164 | {
|
| 165 | BOOLEAN testEnable; /**< Gate execution/updating of results with this flag */
|
| 166 | BOOLEAN testDataValid; /**< Indicates if test data is valid (1) or stale (0) */
|
| 167 | proslicTestObj vbat; /**< VBAT test results */
|
| 168 | uInt8 testResult; /**< OR of all test results in this structure */
|
| 169 | } proslicBatteryTest;
|
| 170 |
|
| 171 | /**
|
| 172 | * Defines structure for Audio Test
|
| 173 | */
|
| 174 | typedef struct
|
| 175 | {
|
| 176 | BOOLEAN testEnable; /**< Gate execution/updating of results with this flag */
|
| 177 | BOOLEAN testDataValid; /**< Indicates if test data is valid (1) or stale (0) */
|
| 178 | BOOLEAN abortIfLineInUse; /**< Abort test if LCR set at the start of test. Leaves results invalid */
|
| 179 | int32
|
| 180 | zerodBm_mVpk; /**< 0dBm voltage (in mVpk) of ref impedance */
|
| 181 | proslicTestObj txGain; /**< TX path gain test results */
|
| 182 | proslicTestObj rxGain; /**< RX path gain test results */
|
| 183 | uInt8 testResult; /**< OR of all test results in this structure */
|
| 184 | } proslicAudioTest;
|
| 185 |
|
| 186 |
|
| 187 | /**
|
| 188 | * Defines structure for all tests
|
| 189 | */
|
| 190 | typedef struct
|
| 191 | {
|
| 192 | proslicPcmLpbkTest pcmLpbkTest;
|
| 193 | proslicDcFeedTest dcFeedTest;
|
| 194 | proslicRingingTest ringingTest;
|
| 195 | proslicBatteryTest batteryTest;
|
| 196 | proslicAudioTest audioTest;
|
| 197 | } proslicTestInObjType;
|
| 198 |
|
| 199 | typedef proslicTestInObjType *proslicTestInObjType_ptr;
|
| 200 |
|
| 201 |
|
| 202 | /**
|
| 203 | * @brief
|
| 204 | * Allocate memory and initialize the given structure.
|
| 205 | *
|
| 206 | * @param[in,out] *pTstin - the structure to initialize
|
| 207 | * @param[in] num_objs - number of Testin structures to allocate.
|
| 208 | *
|
| 209 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 210 | * @sa ProSLIC_DestroyTestInObjs
|
| 211 | */
|
| 212 | int ProSLIC_createTestInObjs(proslicTestInObjType_ptr *pTstin, uInt32 num_objs);
|
| 213 | #define ProSLIC_createTestInObj(X) ProSLIC_createTestInObjs((X),1)
|
| 214 |
|
| 215 | /**
|
| 216 | * @brief
|
| 217 | * Free memory reserved by the given structure.
|
| 218 | *
|
| 219 | * @param[in,out] *pTstin - the structure to initialize
|
| 220 | *
|
| 221 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 222 | */
|
| 223 | int ProSLIC_destroyTestInObjs(proslicTestInObjType_ptr *pTstin);
|
| 224 | #define ProSLIC_destroyTestInObj ProSLIC_destroyTestInObjs
|
| 225 |
|
| 226 | /**
|
| 227 | * @brief
|
| 228 | * Enable PCM loopback.
|
| 229 | *
|
| 230 | * @param[in] pProslic - channel data structure
|
| 231 | * @param[in,out] pTstin - all control, limits, and results
|
| 232 | *
|
| 233 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 234 | */
|
| 235 | int ProSLIC_testInPCMLpbkEnable(proslicChanType_ptr pProslic,
|
| 236 | proslicTestInObjType_ptr pTstin);
|
| 237 |
|
| 238 |
|
| 239 | /**
|
| 240 | * @brief
|
| 241 | * Disable PCM loopback.
|
| 242 | *
|
| 243 | * @param[in] pProslic - channel data structure
|
| 244 | * @param[in,out] pTstin - all control, limits, and results
|
| 245 | *
|
| 246 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 247 | */
|
| 248 | int ProSLIC_testInPCMLpbkDisable(proslicChanType_ptr pProslic,
|
| 249 | proslicTestInObjType_ptr pTstin);
|
| 250 |
|
| 251 |
|
| 252 | /**
|
| 253 | * @brief
|
| 254 | * DC Feed Test - the pTstin->dcFeedTest contains control, limits and test result information.
|
| 255 | *
|
| 256 | * @param[in] pProslic - channel data structure
|
| 257 | * @param[in,out] pTstin - all control, limits, and results
|
| 258 | *
|
| 259 | * @retval int - error from @ref errorCodeType
|
| 260 | * @retval RC_TEST_PASSED indicates test completed and passed
|
| 261 | * @retval RC_TEST_FAILED indicates test completed and failed
|
| 262 | * @retval RC_UNSUPPORTED_FEATURE indicates feature not supported on this device
|
| 263 | * @retval RC_TEST_DISABLED indicates test has not been initialized/enabled
|
| 264 | * @retval RC_LINE_IN_USE indicates LCS already set
|
| 265 | *
|
| 266 | */
|
| 267 | int ProSLIC_testInDCFeed(proslicChanType_ptr pProslic,
|
| 268 | proslicTestInObjType_ptr pTstin);
|
| 269 |
|
| 270 |
|
| 271 | /**
|
| 272 | * @brief
|
| 273 | * Ringing and Ringtrip Test
|
| 274 | *
|
| 275 | * @param[in] pProslic - channel data structure
|
| 276 | * @param[in,out] pTstin - all control, limits, and results
|
| 277 | *
|
| 278 | * @retval int - error from @ref errorCodeType
|
| 279 | * @retval RC_TEST_PASSED indicates test completed and passed
|
| 280 | * @retval RC_TEST_FAILED indicates test completed and failed
|
| 281 | * @retval RC_UNSUPPORTED_FEATURE indicates feature not supported on this device
|
| 282 | * @retval RC_TEST_DISABLED indicates test has not been initialized/enabled
|
| 283 | * @retval RC_LINE_IN_USE indicates LCS already set
|
| 284 | *
|
| 285 | */
|
| 286 | int ProSLIC_testInRinging(proslicChanType_ptr pProslic,
|
| 287 | proslicTestInObjType_ptr pTstin);
|
| 288 |
|
| 289 | /**
|
| 290 | * @brief
|
| 291 | * Battery Test -
|
| 292 | * pTstin contains both the configuration data and test results.
|
| 293 | * See **pTstin->batteryTest.testResult - Pass/Fail result
|
| 294 | *
|
| 295 | * @param[in] pProslic - channel data structure
|
| 296 | * @param[in,out] pTstin - configuration and test results
|
| 297 | *
|
| 298 | * @retval int - error from @ref errorCodeType
|
| 299 | * @retval RC_TEST_PASSED indicates test completed and passed
|
| 300 | * @retval RC_TEST_FAILED indicates test completed and failed
|
| 301 | * @retval RC_UNSUPPORTED_FEATURE indicates feature not supported on this device
|
| 302 | * @retval RC_TEST_DISABLED indicates test has not been initialized/enabled
|
| 303 | *
|
| 304 | */
|
| 305 | int ProSLIC_testInBattery(proslicChanType_ptr pProslic,
|
| 306 | proslicTestInObjType_ptr pTstin);
|
| 307 |
|
| 308 | /**
|
| 309 | * @brief
|
| 310 | * Audio level inward test. pTstin->audioTest contains all control, limits and results.
|
| 311 | *
|
| 312 | * @param[in] pProslic - channel data structure
|
| 313 | * @param[in,out] pTstin - all control, limits, and results
|
| 314 | *
|
| 315 | * @retval int - error from @ref errorCodeType
|
| 316 | * @retval RC_TEST_PASSED indicates test completed and passed
|
| 317 | * @retval RC_TEST_FAILED indicates test completed and failed
|
| 318 | * @retval RC_UNSUPPORTED_FEATURE indicates feature not supported on this device
|
| 319 | * @retval RC_TEST_DISABLED indicates test has not been initialized/enabled
|
| 320 | * @retval RC_LINE_IN_USE indicates LCS already set
|
| 321 | *
|
| 322 | */
|
| 323 | int ProSLIC_testInAudio(proslicChanType_ptr pProslic,
|
| 324 | proslicTestInObjType_ptr pTstin);
|
| 325 |
|
| 326 | /**
|
| 327 | * @brief
|
| 328 | * Initialize/Enable PCM Loopback Test. Links test config/limits
|
| 329 | * to inward test data structure.
|
| 330 | *
|
| 331 | * @param[in,out] pTstin->pcmLpbkTest - all control, limits, and results
|
| 332 | * @param[in] pcmLpbkTest - test config and limits to link to pTstin->pcmLpbkTest
|
| 333 | *
|
| 334 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 335 | */
|
| 336 | int ProSLIC_testInPcmLpbkSetup(proslicTestInObjType *pTstin,
|
| 337 | proslicPcmLpbkTest *pcmLpbkTest);
|
| 338 |
|
| 339 | /**
|
| 340 | * @brief
|
| 341 | * Initialize/Enable DC Feed Test. Links test config/limits
|
| 342 | * to inward test data structure.
|
| 343 | *
|
| 344 | * @param[in,out] pTstin->dcFeedTest - all control, limits, and results
|
| 345 | * @param[in] dcFeedTest - test config and limits to link to pTstin->dcFeedTest
|
| 346 | *
|
| 347 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 348 | */
|
| 349 | int ProSLIC_testInDcFeedSetup(proslicTestInObjType *pTstin,
|
| 350 | proslicDcFeedTest *dcFeedTest);
|
| 351 |
|
| 352 | /**
|
| 353 | * @brief
|
| 354 | * Initialize/Enable Ringing Test. Links test config/limits
|
| 355 | * to inward test data structure.
|
| 356 | *
|
| 357 | * @param[in,out] pTstin->ringingTest - all control, limits, and results
|
| 358 | * @param[in] ringingTest - test config and limits to link to pTstin->ringingTest
|
| 359 | *
|
| 360 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 361 | */
|
| 362 | int ProSLIC_testInRingingSetup(proslicTestInObjType *pTstin,
|
| 363 | proslicRingingTest *ringingTest);
|
| 364 |
|
| 365 | /**
|
| 366 | * @brief
|
| 367 | * Initialize/Enable Battery Test. Links test config/limits
|
| 368 | * to inward test data structure.
|
| 369 | *
|
| 370 | * @param[in,out] pTstin->batteryTest - all control, limits, and results
|
| 371 | * @param[in] batteryTest - test config and limits to link to pTstin->batteryTest
|
| 372 | *
|
| 373 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 374 | */
|
| 375 | int ProSLIC_testInBatterySetup(proslicTestInObjType *pTstin,
|
| 376 | proslicBatteryTest *batteryTest);
|
| 377 |
|
| 378 | /**
|
| 379 | * @brief
|
| 380 | * Initialize/Enable Audio Test. Links test config/limits
|
| 381 | * to inward test data structure.
|
| 382 | *
|
| 383 | * @param[in,out] pTstin->audioTest - all control, limits, and results
|
| 384 | * @param[in] audioTest - test config and limits to link to pTstin->audioTest
|
| 385 | *
|
| 386 | * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
|
| 387 | */
|
| 388 | int ProSLIC_testInAudioSetup(proslicTestInObjType *pTstin,
|
| 389 | proslicAudioTest *audioTest);
|
| 390 |
|
| 391 |
|
| 392 | /**
|
| 393 | * @brief
|
| 394 | * Debug utility to log presently loaded test limits
|
| 395 | *
|
| 396 | * @param[in] pProslic - channel data structure
|
| 397 | * @param[in] pTstin - inward test data structure
|
| 398 | *
|
| 399 | * @retval int - error from @ref errorCodeType
|
| 400 | * @retval RC_NONE indicates no error.
|
| 401 | * @retval RC_UNSUPPORTED_FEATURE indicates feature not supported on this device
|
| 402 | */
|
| 403 | int ProSLIC_testInPrintLimits(proslicChanType *pProslic,
|
| 404 | proslicTestInObjType *pTstin);
|
| 405 |
|
| 406 | /** @} PROSLIC_TSTIN */
|
| 407 | /** @} DIAGNOSTICS */
|
| 408 | #endif
|
| 409 |
|