b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /****************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2006-2015 Lantiq Deutschland GmbH |
| 4 | Copyright (c) 2015 Lantiq Beteiligungs-GmbH & Co.KG |
| 5 | Copyright 2018, Intel Corporation. |
| 6 | |
| 7 | For licensing information, see the file 'LICENSE' in the root folder of |
| 8 | this software module. |
| 9 | |
| 10 | ******************************************************************************/ |
| 11 | |
| 12 | /** |
| 13 | \file dxs_api.c |
| 14 | This file contains the function prototypes specific to the DXS library |
| 15 | interface and is used by applications. |
| 16 | */ |
| 17 | |
| 18 | /* ========================================================================== */ |
| 19 | /* Includes */ |
| 20 | /* ========================================================================== */ |
| 21 | #include "dxs.h" |
| 22 | #include "dxs_init.h" |
| 23 | #include "dxs_errno.h" |
| 24 | #include "dxs_error.h" |
| 25 | #include "dxs_config.h" |
| 26 | #include "dxs_bbd.h" |
| 27 | #include "dxs_wait.h" |
| 28 | #include "dxs_sdd.h" |
| 29 | #include "dxs_gpio.h" |
| 30 | #include "dxs_cid.h" |
| 31 | #include "dxs_pcm.h" |
| 32 | #include "dxs_dwld.h" |
| 33 | #include "dxs_sig.h" |
| 34 | #include "dxs_debug_api.h" |
| 35 | #include "dxs_event.h" |
| 36 | #include "dxs_dcdc_hw.h" |
| 37 | #include "dxs_ring.h" |
| 38 | |
| 39 | /* ========================================================================== */ |
| 40 | /* Macro definitions */ |
| 41 | /* ========================================================================== */ |
| 42 | #define DXS_DEV_CTX_GET \ |
| 43 | do { \ |
| 44 | pDev = dxs_get_dev(dxs); \ |
| 45 | if (pDev == NULL) { \ |
| 46 | DXS_ERROR_PUSH(DXS_statusDevNotFound); \ |
| 47 | return DXS_statusDevNotFound; \ |
| 48 | } \ |
| 49 | } while(0) |
| 50 | |
| 51 | #define DXS_DEV_INIT_VALIDATE \ |
| 52 | do { \ |
| 53 | if (!(pDev->flags & DXS_DEV_INITIALIZED)) { \ |
| 54 | DXS_ERROR_PUSH(DXS_statusDevNotInitialized); \ |
| 55 | return DXS_statusDevNotInitialized; \ |
| 56 | } \ |
| 57 | } while(0) |
| 58 | |
| 59 | #define DXS_CH_CTX_GET \ |
| 60 | do { \ |
| 61 | if (line >= pDev->nChannels) { \ |
| 62 | DXS_ERROR_PUSH(DXS_statusChannelNotFound); \ |
| 63 | return DXS_statusChannelNotFound; \ |
| 64 | } \ |
| 65 | pCh = &pDev->pChannel[line]; \ |
| 66 | if (pCh == NULL){ \ |
| 67 | DXS_ERROR_PUSH(DXS_statusChannelNotFound); \ |
| 68 | return DXS_statusChannelNotFound; \ |
| 69 | } \ |
| 70 | } while(0) |
| 71 | |
| 72 | #define DXS_API_EXIT(ret) \ |
| 73 | do { \ |
| 74 | if (ret != DXS_statusOk) { \ |
| 75 | DXS_ERROR_PUSH(ret); \ |
| 76 | } \ |
| 77 | return ret; \ |
| 78 | } while(0) |
| 79 | |
| 80 | #define DXS_DEV_API_ENTRY \ |
| 81 | do { \ |
| 82 | DXS_DEV_CTX_GET; \ |
| 83 | DXS_ERROR_RESET; \ |
| 84 | DXS_DEV_INIT_VALIDATE; \ |
| 85 | } while(0) |
| 86 | |
| 87 | #define DXS_CH_API_ENTRY \ |
| 88 | do { \ |
| 89 | DXS_DEV_API_ENTRY; \ |
| 90 | DXS_CH_CTX_GET; \ |
| 91 | } while(0) |
| 92 | |
| 93 | /* ========================================================================== */ |
| 94 | /* Type definitions */ |
| 95 | /* ========================================================================== */ |
| 96 | |
| 97 | /* ========================================================================== */ |
| 98 | /* Global variables */ |
| 99 | /* ========================================================================== */ |
| 100 | |
| 101 | /* ========================================================================== */ |
| 102 | /* Function prototypes */ |
| 103 | /* ========================================================================== */ |
| 104 | |
| 105 | /* ========================================================================== */ |
| 106 | /* Function implementation */ |
| 107 | /* ========================================================================== */ |
| 108 | /** |
| 109 | DXS Device Init |
| 110 | |
| 111 | \param dxs - device number |
| 112 | \param chipSelect - CS number |
| 113 | \param irqNumber - IRQ line number |
| 114 | \param dcdcType - DCDC variant handled by DXS_DCDC_Var_t type |
| 115 | |
| 116 | \return |
| 117 | - DXS_statusOk or DXS_statusError |
| 118 | */ |
| 119 | int32_t DxsInit(uint8_t dxs, uint8_t chipSelect, int32_t irqNumber, |
| 120 | uint8_t dcdcType, uint8_t acc_mode) |
| 121 | { |
| 122 | DXS_DEVICE_t *pDev; |
| 123 | int32_t ret; |
| 124 | |
| 125 | DXS_DEV_CTX_GET; |
| 126 | DXS_ERROR_RESET; |
| 127 | |
| 128 | ret = dxs_init(pDev, chipSelect, irqNumber, dcdcType, acc_mode, dxs); |
| 129 | |
| 130 | DXS_API_EXIT(ret); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | DXS Device Exit |
| 135 | |
| 136 | \param dxs - device number |
| 137 | |
| 138 | \return |
| 139 | - DXS_statusOk |
| 140 | */ |
| 141 | int32_t DxsExit(uint8_t dxs) |
| 142 | { |
| 143 | DXS_DEVICE_t *pDev; |
| 144 | int32_t ret; |
| 145 | |
| 146 | DXS_DEV_API_ENTRY; |
| 147 | |
| 148 | ret = dxs_exit(pDev); |
| 149 | |
| 150 | DXS_API_EXIT(ret); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | DXS BBD Download |
| 155 | |
| 156 | \param dxs - channel number |
| 157 | \param pBbd - pointer to BBD data |
| 158 | \param nBytes - BBD data size |
| 159 | |
| 160 | \return |
| 161 | - DXS_statusOk or DXS_statusError |
| 162 | */ |
| 163 | int32_t DxsBBD(uint8_t dxs, uint8_t line, uint8_t *pBbd, uint32_t nBytes) |
| 164 | { |
| 165 | DXS_DEVICE_t *pDev; |
| 166 | DXS_CHANNEL_t *pCh; |
| 167 | int32_t ret; |
| 168 | |
| 169 | DXS_CH_API_ENTRY; |
| 170 | |
| 171 | ret = dxs_bbd_download(pCh, pBbd, nBytes); |
| 172 | |
| 173 | DXS_API_EXIT(ret); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | DXS PRAM Patch Download |
| 178 | |
| 179 | \param dxs - device number |
| 180 | \param pPatch - pointer to PRAM patch data |
| 181 | \param nBytes - PRAM patch data size |
| 182 | |
| 183 | \return |
| 184 | - DXS_statusOk or DXS_statusError |
| 185 | */ |
| 186 | int32_t DxsPatch(uint8_t dxs, uint8_t *pPatch, uint32_t nBytes) |
| 187 | { |
| 188 | DXS_DEVICE_t *pDev; |
| 189 | int32_t ret; |
| 190 | |
| 191 | DXS_DEV_API_ENTRY; |
| 192 | |
| 193 | ret = DXS_FW_Select(pDev, pPatch, nBytes); |
| 194 | |
| 195 | DXS_API_EXIT(ret); |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | DXS Firmware Capabilities Read |
| 200 | |
| 201 | \param dxs - device number |
| 202 | \param pCap - pointer to DXS_Caps_t structure |
| 203 | |
| 204 | \return |
| 205 | - DXS_statusOk or DXS_statusError |
| 206 | */ |
| 207 | int32_t DxsCapabilitiesRead(uint8_t dxs, DXS_Caps_t *pCap) |
| 208 | { |
| 209 | DXS_DEVICE_t *pDev; |
| 210 | int32_t ret; |
| 211 | |
| 212 | DXS_DEV_API_ENTRY; |
| 213 | |
| 214 | ret = dxs_caps_read(pDev, pCap); |
| 215 | |
| 216 | DXS_API_EXIT(ret); |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | DXS Version Read |
| 221 | |
| 222 | \param dxs - device number |
| 223 | \param pVersion - pointer to DXS_Version_t structure |
| 224 | |
| 225 | \return |
| 226 | - DXS_statusOk or DXS_statusError |
| 227 | */ |
| 228 | int32_t DxsVersionRead(uint8_t dxs, DXS_Version_t *pVersion) |
| 229 | { |
| 230 | DXS_DEVICE_t *pDev; |
| 231 | int32_t ret; |
| 232 | |
| 233 | DXS_DEV_API_ENTRY; |
| 234 | |
| 235 | ret = dxs_vers_read(pDev, pVersion); |
| 236 | |
| 237 | DXS_API_EXIT(ret); |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | DXS Sleep Mode Enable |
| 242 | |
| 243 | \param dxs - device number |
| 244 | |
| 245 | \return |
| 246 | - DXS_statusOk or DXS_statusError |
| 247 | */ |
| 248 | int32_t DxsSleepEnable(uint8_t dxs) |
| 249 | { |
| 250 | DXS_DEVICE_t *pDev; |
| 251 | int32_t ret; |
| 252 | |
| 253 | DXS_DEV_API_ENTRY; |
| 254 | |
| 255 | ret = dxs_sleep(pDev, 1); |
| 256 | |
| 257 | DXS_API_EXIT(ret); |
| 258 | } |
| 259 | |
| 260 | /** |
| 261 | DXS Sleep Mode Disable |
| 262 | |
| 263 | \param dxs - device number |
| 264 | |
| 265 | \return |
| 266 | - DXS_statusOk or DXS_statusError |
| 267 | */ |
| 268 | int32_t DxsSleepDisable(uint8_t dxs) |
| 269 | { |
| 270 | DXS_DEVICE_t *pDev; |
| 271 | int32_t ret; |
| 272 | |
| 273 | DXS_DEV_API_ENTRY; |
| 274 | |
| 275 | ret = dxs_sleep(pDev, 0); |
| 276 | |
| 277 | DXS_API_EXIT(ret); |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | PCM Interface Enable |
| 282 | |
| 283 | \param dxs - device number |
| 284 | \param xoff - transmit bit offset |
| 285 | \param dbl - double bit clock |
| 286 | \param xs - transmit slope |
| 287 | \param rs - receive slope |
| 288 | \param drv0 - bit 0 drive length |
| 289 | \param sh - shift control |
| 290 | \param roff - receive bit offset |
| 291 | |
| 292 | \return |
| 293 | - DXS_statusOk or DXS_statusError |
| 294 | */ |
| 295 | int32_t DxsPcmInterfaceEnable(uint8_t dxs, uint8_t xoff, uint8_t dbl, |
| 296 | uint8_t xs, uint8_t rs, uint8_t drv0, |
| 297 | uint8_t sh, uint8_t roff) |
| 298 | { |
| 299 | DXS_DEVICE_t *pDev; |
| 300 | int32_t ret; |
| 301 | |
| 302 | DXS_DEV_API_ENTRY; |
| 303 | |
| 304 | ret = dxs_pcm_if_config(pDev, xoff, dbl, xs, rs, drv0, sh, roff); |
| 305 | |
| 306 | DXS_API_EXIT(ret); |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | PCM Channel Enable |
| 311 | |
| 312 | \param dxs - device number |
| 313 | \param line - line number |
| 314 | \param wb - wideband |
| 315 | \param wbtsc - wideband PCM time slot configuration |
| 316 | \param codec - codec |
| 317 | \param xts - transmit highway time slot |
| 318 | \param rts - receive highway time slot |
| 319 | |
| 320 | \return |
| 321 | - DXS_statusOk or DXS_statusError |
| 322 | */ |
| 323 | int32_t DxsPcmChannelEnable(uint8_t dxs, uint8_t line, uint8_t wb, uint8_t wbtsc, |
| 324 | uint8_t codec, uint8_t xts, uint8_t rts) |
| 325 | { |
| 326 | DXS_DEVICE_t *pDev; |
| 327 | DXS_CHANNEL_t *pCh; |
| 328 | int32_t ret; |
| 329 | |
| 330 | DXS_CH_API_ENTRY; |
| 331 | |
| 332 | ret = dxs_pcm_ch_act(pCh, wb, wbtsc, codec, xts, rts); |
| 333 | |
| 334 | DXS_API_EXIT(ret); |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | PCM Channel Disable |
| 339 | |
| 340 | \param dxs - device number |
| 341 | \param line - line number |
| 342 | |
| 343 | \return |
| 344 | - DXS_statusOk or DXS_statusError |
| 345 | */ |
| 346 | int32_t DxsPcmChannelDisable(uint8_t dxs, uint8_t line) |
| 347 | { |
| 348 | DXS_DEVICE_t *pDev; |
| 349 | DXS_CHANNEL_t *pCh; |
| 350 | int32_t ret; |
| 351 | |
| 352 | DXS_CH_API_ENTRY; |
| 353 | |
| 354 | ret = dxs_pcm_ch_deact(pCh); |
| 355 | |
| 356 | DXS_API_EXIT(ret); |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | PCM Channel Mute in RX direction |
| 361 | |
| 362 | \param dxs - device number |
| 363 | \param line - line number |
| 364 | |
| 365 | \return |
| 366 | - DXS_statusOk or DXS_statusError |
| 367 | */ |
| 368 | int32_t DxsPcmChannelMute(uint8_t dxs, uint8_t line) |
| 369 | { |
| 370 | DXS_DEVICE_t *pDev; |
| 371 | DXS_CHANNEL_t *pCh; |
| 372 | int32_t ret; |
| 373 | |
| 374 | DXS_CH_API_ENTRY; |
| 375 | |
| 376 | ret = dxs_pcm_ch_mute(pCh, 1); |
| 377 | |
| 378 | DXS_API_EXIT(ret); |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | PCM Channel Unmute in RX direction |
| 383 | |
| 384 | \param dxs - device number |
| 385 | \param line - line number |
| 386 | |
| 387 | \return |
| 388 | - DXS_statusOk or DXS_statusError |
| 389 | */ |
| 390 | int32_t DxsPcmChannelUnmute(uint8_t dxs, uint8_t line) |
| 391 | { |
| 392 | DXS_DEVICE_t *pDev; |
| 393 | DXS_CHANNEL_t *pCh; |
| 394 | int32_t ret; |
| 395 | |
| 396 | DXS_CH_API_ENTRY; |
| 397 | |
| 398 | ret = dxs_pcm_ch_mute(pCh, 0); |
| 399 | |
| 400 | DXS_API_EXIT(ret); |
| 401 | } |
| 402 | |
| 403 | /** |
| 404 | Ring configuration |
| 405 | |
| 406 | \param dxs - device number |
| 407 | \param line - line number |
| 408 | \param waveForm - waveform type |
| 409 | \param crestFactor - crest factor |
| 410 | \param frequency - frequency |
| 411 | \param amplitude - amplitude |
| 412 | \param dcOffset - DC offset |
| 413 | |
| 414 | \return |
| 415 | - DXS_statusOk or DXS_statusError |
| 416 | */ |
| 417 | int32_t DxsRingConfig(uint8_t dxs, uint8_t line, uint8_t waveForm, |
| 418 | uint8_t crestFactor, uint8_t frequency, |
| 419 | uint16_t amplitude, uint16_t dcOffset) |
| 420 | { |
| 421 | DXS_DEVICE_t *pDev; |
| 422 | DXS_CHANNEL_t *pCh; |
| 423 | int32_t ret; |
| 424 | |
| 425 | DXS_CH_API_ENTRY; |
| 426 | |
| 427 | ret = DXS_SDD_RingConfigAPI(pCh, waveForm, crestFactor, frequency, |
| 428 | amplitude, dcOffset); |
| 429 | |
| 430 | DXS_API_EXIT(ret); |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | Message Waiting Lamp configuration |
| 435 | |
| 436 | \param dxs - device number |
| 437 | \param line - line number |
| 438 | \param voltage - voltage |
| 439 | \param thresh - threshold |
| 440 | \param slope - slope |
| 441 | \param onTime - on-time |
| 442 | \param offTime - off-time |
| 443 | |
| 444 | \return |
| 445 | - DXS_statusOk or DXS_statusError |
| 446 | */ |
| 447 | int32_t DxsMwlConfig(uint8_t dxs, uint8_t line, uint8_t voltage, uint8_t thresh, |
| 448 | uint16_t slope, uint16_t onTime, uint16_t offTime) |
| 449 | { |
| 450 | DXS_DEVICE_t *pDev; |
| 451 | DXS_CHANNEL_t *pCh; |
| 452 | int32_t ret; |
| 453 | |
| 454 | DXS_CH_API_ENTRY; |
| 455 | |
| 456 | ret = DXS_SDD_MwlConfigAPI(pCh, voltage, thresh, slope, onTime, offTime); |
| 457 | |
| 458 | DXS_API_EXIT(ret); |
| 459 | } |
| 460 | |
| 461 | /** |
| 462 | Digital gain configuration |
| 463 | |
| 464 | \param dxs - device number |
| 465 | \param line - line number |
| 466 | \param usg - upstream relative level setting |
| 467 | \param dsg - downstream relative level setting |
| 468 | |
| 469 | \return |
| 470 | - DXS_statusOk or DXS_statusError |
| 471 | */ |
| 472 | int32_t DxsGainsSet(uint8_t dxs, uint8_t line, int16_t TxGain, int16_t RxGain) |
| 473 | { |
| 474 | DXS_DEVICE_t *pDev; |
| 475 | DXS_CHANNEL_t *pCh; |
| 476 | int32_t ret; |
| 477 | |
| 478 | DXS_CH_API_ENTRY; |
| 479 | |
| 480 | ret = DXS_SDD_GainSet(pCh, TxGain, RxGain); |
| 481 | |
| 482 | DXS_API_EXIT(ret); |
| 483 | } |
| 484 | |
| 485 | /** |
| 486 | Digital gain readback |
| 487 | |
| 488 | \param dxs - device number |
| 489 | \param line - line number |
| 490 | \param pusg - pointer to upstream relative level setting |
| 491 | \param pdsg - pointer to downstream relative level setting |
| 492 | |
| 493 | \return |
| 494 | - DXS_statusOk or DXS_statusError |
| 495 | */ |
| 496 | int32_t DxsGainsGet(uint8_t dxs, uint8_t line, int16_t *pTxGain, int16_t *pRxGain) |
| 497 | { |
| 498 | DXS_DEVICE_t *pDev; |
| 499 | DXS_CHANNEL_t *pCh; |
| 500 | int32_t ret; |
| 501 | |
| 502 | DXS_CH_API_ENTRY; |
| 503 | |
| 504 | ret = DXS_SDD_GainGet(pCh, pTxGain, pRxGain); |
| 505 | |
| 506 | DXS_API_EXIT(ret); |
| 507 | } |
| 508 | |
| 509 | /** |
| 510 | Line feeding mode set |
| 511 | |
| 512 | \param dxs - device number |
| 513 | \param line - line number |
| 514 | \param mode - line feeding mode |
| 515 | |
| 516 | \return |
| 517 | - DXS_statusOk or DXS_statusError |
| 518 | */ |
| 519 | int32_t DxsLineModeSet(uint8_t dxs, uint8_t line, int mode) |
| 520 | { |
| 521 | DXS_DEVICE_t *pDev; |
| 522 | DXS_CHANNEL_t *pCh; |
| 523 | int32_t ret; |
| 524 | |
| 525 | DXS_CH_API_ENTRY; |
| 526 | |
| 527 | /* We need to signal that calibration was started by API */ |
| 528 | if (mode == DXS_LINE_FEED_CALIBRATE) |
| 529 | (void) DXS_SDD_CalibrationInternalSet(pCh, 0); |
| 530 | ret = DXS_SDD_LineModeSet(pCh, mode); |
| 531 | |
| 532 | DXS_API_EXIT(ret); |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | Line feeding mode read |
| 537 | |
| 538 | \param dxs - device number |
| 539 | \param line - line number |
| 540 | \param pMode - pointer to line feeding mode |
| 541 | |
| 542 | \return |
| 543 | - DXS_statusOk or DXS_statusError |
| 544 | */ |
| 545 | int32_t DxsLineModeGet(uint8_t dxs, uint8_t line, int *pMode) |
| 546 | { |
| 547 | DXS_DEVICE_t *pDev; |
| 548 | DXS_CHANNEL_t *pCh; |
| 549 | int32_t ret; |
| 550 | |
| 551 | DXS_CH_API_ENTRY; |
| 552 | |
| 553 | ret = DXS_SDD_LineModeGet(pCh, pMode); |
| 554 | |
| 555 | DXS_API_EXIT(ret); |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | Read from DXS internal register |
| 560 | (requires --enable-debug-api) |
| 561 | |
| 562 | \param dxs - device number |
| 563 | \param offset - register offset |
| 564 | \param pValue - pointer to value returned |
| 565 | |
| 566 | \return |
| 567 | - DXS_statusOk or DXS_statusError |
| 568 | */ |
| 569 | int32_t DxsDebugRegRead16(uint8_t dxs, uint8_t offset, uint16_t *pValue) |
| 570 | { |
| 571 | DXS_DEVICE_t *pDev; |
| 572 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 573 | |
| 574 | DXS_DEV_API_ENTRY; |
| 575 | |
| 576 | #ifdef DXS_FEAT_DEBUG_API |
| 577 | ret = dxs_reg_read (pDev, offset, pValue, 1); |
| 578 | #endif /* DXS_FEAT_DEBUG_API */ |
| 579 | |
| 580 | DXS_API_EXIT(ret); |
| 581 | } |
| 582 | |
| 583 | /** |
| 584 | Write into DXS internal register |
| 585 | (requires --enable-debug-api) |
| 586 | |
| 587 | \param dxs - device number |
| 588 | \param offset - register offset |
| 589 | \param value - value |
| 590 | |
| 591 | \return |
| 592 | - DXS_statusOk or DXS_statusError |
| 593 | */ |
| 594 | int32_t DxsDebugRegWrite16(uint8_t dxs, uint8_t offset, uint16_t value) |
| 595 | { |
| 596 | DXS_DEVICE_t *pDev; |
| 597 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 598 | uint16_t temp_value = value; |
| 599 | |
| 600 | DXS_DEV_API_ENTRY; |
| 601 | |
| 602 | #ifdef DXS_FEAT_DEBUG_API |
| 603 | ret = dxs_reg_write (pDev, offset, &temp_value, 1); |
| 604 | #endif /* DXS_FEAT_DEBUG_API */ |
| 605 | |
| 606 | DXS_API_EXIT(ret); |
| 607 | } |
| 608 | |
| 609 | /** |
| 610 | Read from DXS internal register |
| 611 | (requires --enable-debug-api) |
| 612 | |
| 613 | \param dxs - device number |
| 614 | \param offset - register offset |
| 615 | \param pValue - pointer to value returned |
| 616 | |
| 617 | \return |
| 618 | - DXS_statusOk or DXS_statusError |
| 619 | */ |
| 620 | int32_t DxsDebugRegRead32(uint8_t dxs, uint8_t offset, uint32_t *pValue) |
| 621 | { |
| 622 | DXS_DEVICE_t *pDev; |
| 623 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 624 | |
| 625 | DXS_DEV_API_ENTRY; |
| 626 | |
| 627 | #ifdef DXS_FEAT_DEBUG_API |
| 628 | ret = dxs_reg_read (pDev, offset, (uint16_t *)pValue, 2); |
| 629 | #endif /* DXS_FEAT_DEBUG_API */ |
| 630 | |
| 631 | DXS_API_EXIT(ret); |
| 632 | } |
| 633 | |
| 634 | /** |
| 635 | Write into DXS internal register |
| 636 | (requires --enable-debug-api) |
| 637 | |
| 638 | \param dxs - device number |
| 639 | \param offset - register offset |
| 640 | \param value - value |
| 641 | |
| 642 | \return |
| 643 | - DXS_statusOk or DXS_statusError |
| 644 | */ |
| 645 | int32_t DxsDebugRegWrite32(uint8_t dxs, uint8_t offset, uint32_t value) |
| 646 | { |
| 647 | DXS_DEVICE_t *pDev; |
| 648 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 649 | uint32_t temp_value = value; |
| 650 | |
| 651 | DXS_DEV_API_ENTRY; |
| 652 | |
| 653 | #ifdef DXS_FEAT_DEBUG_API |
| 654 | ret = dxs_reg_write (pDev, offset, (uint16_t *)&temp_value, 2); |
| 655 | #endif /* DXS_FEAT_DEBUG_API */ |
| 656 | |
| 657 | DXS_API_EXIT(ret); |
| 658 | } |
| 659 | |
| 660 | /** |
| 661 | Read DXS firmware command |
| 662 | (requires --enable-debug-api) |
| 663 | |
| 664 | \param dxs - device number |
| 665 | \param hdr - command header |
| 666 | \param pLength - length of data |
| 667 | \param pData - pointer to read data into |
| 668 | |
| 669 | \return |
| 670 | - DXS_statusOk or DXS_statusError |
| 671 | */ |
| 672 | int32_t DxsDebugCmdRead(uint8_t dxs, uint32_t hdr, |
| 673 | uint8_t *pLength, uint32_t *pData) |
| 674 | { |
| 675 | DXS_DEVICE_t *pDev; |
| 676 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 677 | |
| 678 | DXS_DEV_API_ENTRY; |
| 679 | |
| 680 | #ifdef DXS_FEAT_DEBUG_API |
| 681 | ret = dxs_cmd_read (pDev, hdr, pData, pLength); |
| 682 | #endif /* DXS_FEAT_DEBUG_API */ |
| 683 | |
| 684 | DXS_API_EXIT(ret); |
| 685 | } |
| 686 | |
| 687 | /** |
| 688 | Write DXS firmware command |
| 689 | (requires --enable-debug-api) |
| 690 | |
| 691 | \param dxs - device number |
| 692 | \param length - the length of buffer |
| 693 | \param pCmd - pointer to buffer with command |
| 694 | |
| 695 | \return |
| 696 | - DXS_statusOk or DXS_statusError |
| 697 | */ |
| 698 | int32_t DxsDebugCmdWrite(uint8_t dxs, uint8_t length, uint32_t *pCmd) |
| 699 | { |
| 700 | DXS_DEVICE_t *pDev; |
| 701 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 702 | |
| 703 | DXS_DEV_API_ENTRY; |
| 704 | |
| 705 | #ifdef DXS_FEAT_DEBUG_API |
| 706 | ret = dxs_cmd_write (pDev, pCmd, length); |
| 707 | #endif /* DXS_FEAT_DEBUG_API */ |
| 708 | |
| 709 | DXS_API_EXIT(ret); |
| 710 | } |
| 711 | |
| 712 | #if 0 |
| 713 | /* |
| 714 | * DxsDebugBBDGet() |
| 715 | * requires --enable-debug-api |
| 716 | */ |
| 717 | int32_t DxsDebugBBDGet(uint8_t dxs, int nBuffer, uchar *pBbd, int *nByte) |
| 718 | { |
| 719 | DXS_DEVICE_t *pDev; |
| 720 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 721 | |
| 722 | DXS_DEV_API_ENTRY; |
| 723 | |
| 724 | #ifdef DXS_FEAT_DEBUG_API |
| 725 | /* TODO: ret = dxs_bbd_get (pDev, pCmd, length); */ |
| 726 | #endif /* DXS_FEAT_DEBUG_API */ |
| 727 | |
| 728 | DXS_API_EXIT(ret); |
| 729 | } |
| 730 | #endif |
| 731 | |
| 732 | /** |
| 733 | Tone Configuration |
| 734 | (requires --enable-tg) |
| 735 | |
| 736 | \param dxs - device number |
| 737 | \param line - line number |
| 738 | \param level1 - level for frequency 1 |
| 739 | \param level2 - level for frequency 2 |
| 740 | \param freq1 - tone frequency 1 |
| 741 | \param freq2 - tone frequency 2 |
| 742 | \param amModulated - amplitude modulation flag |
| 743 | |
| 744 | \return |
| 745 | - DXS_statusOk or DXS_statusError |
| 746 | */ |
| 747 | int32_t DxsToneConfig(uint8_t dxs, uint8_t line, int16_t level1, |
| 748 | int16_t level2, uint16_t freq1, uint16_t freq2, |
| 749 | uint8_t amModulated) |
| 750 | { |
| 751 | DXS_DEVICE_t *pDev; |
| 752 | DXS_CHANNEL_t *pCh; |
| 753 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 754 | |
| 755 | DXS_CH_API_ENTRY; |
| 756 | |
| 757 | #ifdef DXS_FEAT_TG |
| 758 | ret = dxs_tone_config(pCh, level1, level2, freq1, freq2, amModulated, 1); |
| 759 | #endif /* DXS_FEAT_TG */ |
| 760 | |
| 761 | DXS_API_EXIT(ret); |
| 762 | } |
| 763 | |
| 764 | /** |
| 765 | Tone Playout Enable |
| 766 | (requires --enable-tg) |
| 767 | |
| 768 | \param dxs - device number |
| 769 | \param line - line number |
| 770 | |
| 771 | \return |
| 772 | - DXS_statusOk or DXS_statusError |
| 773 | */ |
| 774 | int32_t DxsToneEnable(uint8_t dxs, uint8_t line) |
| 775 | { |
| 776 | DXS_DEVICE_t *pDev; |
| 777 | DXS_CHANNEL_t *pCh; |
| 778 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 779 | |
| 780 | DXS_CH_API_ENTRY; |
| 781 | |
| 782 | #ifdef DXS_FEAT_TG |
| 783 | ret = dxs_tone_start(pCh); |
| 784 | #endif /* DXS_FEAT_TG */ |
| 785 | |
| 786 | DXS_API_EXIT(ret); |
| 787 | } |
| 788 | |
| 789 | /** |
| 790 | Tone Playout Disable |
| 791 | (requires --enable-tg) |
| 792 | |
| 793 | \param dxs - device number |
| 794 | \param line - line number |
| 795 | |
| 796 | \return |
| 797 | - DXS_statusOk or DXS_statusError |
| 798 | */ |
| 799 | int32_t DxsToneDisable(uint8_t dxs, uint8_t line) |
| 800 | { |
| 801 | DXS_DEVICE_t *pDev; |
| 802 | DXS_CHANNEL_t *pCh; |
| 803 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 804 | |
| 805 | DXS_CH_API_ENTRY; |
| 806 | |
| 807 | #ifdef DXS_FEAT_TG |
| 808 | ret = dxs_tone_stop(pCh); |
| 809 | #endif /* DXS_FEAT_TG */ |
| 810 | |
| 811 | DXS_API_EXIT(ret); |
| 812 | } |
| 813 | |
| 814 | /** |
| 815 | CID Generator Coefficients update |
| 816 | (requires --enable-fsk) |
| 817 | |
| 818 | \param dxs - device number |
| 819 | \param line - line number |
| 820 | \param level - CID send level |
| 821 | \param seizure - number of seizure bytes |
| 822 | \param mark - number of mark bits |
| 823 | |
| 824 | \return |
| 825 | - DXS_statusOk or DXS_statusError |
| 826 | */ |
| 827 | int32_t DxsFskConfig(uint8_t dxs, uint8_t line, int16_t level, |
| 828 | uint16_t seizure, uint16_t mark) |
| 829 | { |
| 830 | DXS_DEVICE_t *pDev; |
| 831 | DXS_CHANNEL_t *pCh; |
| 832 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 833 | |
| 834 | DXS_CH_API_ENTRY; |
| 835 | |
| 836 | #ifdef DXS_FEAT_FSK |
| 837 | ret = DXS_FSK_Configure(pCh, level, seizure, mark); |
| 838 | #endif /* DXS_FEAT_FSK */ |
| 839 | |
| 840 | DXS_API_EXIT(ret); |
| 841 | } |
| 842 | |
| 843 | /** |
| 844 | CID Generator Enable |
| 845 | (requires --enable-fsk) |
| 846 | |
| 847 | \param dxs - device number |
| 848 | \param line - line number |
| 849 | \param standard - CID standard |
| 850 | \param autodeact - auto deactivation |
| 851 | |
| 852 | \return |
| 853 | - DXS_statusOk or DXS_statusError |
| 854 | */ |
| 855 | int32_t DxsFskEnable(uint8_t dxs, uint8_t line, uint8_t standard, uint8_t autodeact) |
| 856 | { |
| 857 | DXS_DEVICE_t *pDev; |
| 858 | DXS_CHANNEL_t *pCh; |
| 859 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 860 | |
| 861 | DXS_CH_API_ENTRY; |
| 862 | |
| 863 | #ifdef DXS_FEAT_FSK |
| 864 | ret = DXS_FSK_Enable(pCh, standard, autodeact); |
| 865 | #endif /* DXS_FEAT_FSK */ |
| 866 | |
| 867 | DXS_API_EXIT(ret); |
| 868 | } |
| 869 | |
| 870 | /** |
| 871 | CID Generator Disable |
| 872 | (requires --enable-fsk) |
| 873 | |
| 874 | \param dxs - device number |
| 875 | \param line - line number |
| 876 | \param autodeact - auto deactivation |
| 877 | |
| 878 | \return |
| 879 | - DXS_statusOk or DXS_statusError |
| 880 | */ |
| 881 | int32_t DxsFskDisable(uint8_t dxs, uint8_t line, uint8_t autodeact) |
| 882 | { |
| 883 | DXS_DEVICE_t *pDev; |
| 884 | DXS_CHANNEL_t *pCh; |
| 885 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 886 | |
| 887 | DXS_CH_API_ENTRY; |
| 888 | |
| 889 | #ifdef DXS_FEAT_FSK |
| 890 | ret = DXS_FSK_Disable(pCh, autodeact); |
| 891 | #endif /* DXS_FEAT_FSK */ |
| 892 | |
| 893 | DXS_API_EXIT(ret); |
| 894 | } |
| 895 | |
| 896 | /** |
| 897 | Send new data to the CID sender |
| 898 | (requires --enable-fsk) |
| 899 | |
| 900 | \param dxs - device number |
| 901 | \param line - line number |
| 902 | \param nByte - data buffer size |
| 903 | \param pByte - pointer to data buffer |
| 904 | |
| 905 | \return |
| 906 | - DXS_statusOk or DXS_statusError |
| 907 | */ |
| 908 | int32_t DxsFskData(uint8_t dxs, uint8_t line, uint8_t nByte, uint8_t *pByte) |
| 909 | { |
| 910 | DXS_DEVICE_t *pDev; |
| 911 | DXS_CHANNEL_t *pCh; |
| 912 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 913 | |
| 914 | DXS_CH_API_ENTRY; |
| 915 | |
| 916 | #ifdef DXS_FEAT_FSK |
| 917 | ret = DXS_FSK_Data(pCh, nByte, pByte); |
| 918 | #endif /* DXS_FEAT_FSK */ |
| 919 | |
| 920 | DXS_API_EXIT(ret); |
| 921 | } |
| 922 | |
| 923 | /** |
| 924 | Enable UTD |
| 925 | (requires --enable-utd) |
| 926 | |
| 927 | \param dxs - device number |
| 928 | \param line - line number |
| 929 | \param tone_idx - tone index |
| 930 | \param direction - detection direction |
| 931 | |
| 932 | \return |
| 933 | - DXS_statusOk or DXS_statusError |
| 934 | */ |
| 935 | int32_t DxsUtdEnable(uint8_t dxs, uint8_t line, uint16_t tone_idx, |
| 936 | int direction) |
| 937 | { |
| 938 | DXS_DEVICE_t *pDev; |
| 939 | DXS_CHANNEL_t *pCh; |
| 940 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 941 | |
| 942 | DXS_CH_API_ENTRY; |
| 943 | #ifdef DXS_FEAT_UTD |
| 944 | ret = DXS_SIG_UtdEnable(pCh, tone_idx, direction); |
| 945 | #endif /* DXS_FEAT_UTD */ |
| 946 | |
| 947 | DXS_API_EXIT(ret); |
| 948 | } |
| 949 | |
| 950 | /** |
| 951 | Disable UTD |
| 952 | (requires --enable-utd) |
| 953 | |
| 954 | \param dxs - device number |
| 955 | \param line - line number |
| 956 | |
| 957 | \return |
| 958 | - DXS_statusOk or DXS_statusError |
| 959 | */ |
| 960 | int32_t DxsUtdDisable(uint8_t dxs, uint8_t line) |
| 961 | { |
| 962 | DXS_DEVICE_t *pDev; |
| 963 | DXS_CHANNEL_t *pCh; |
| 964 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 965 | |
| 966 | DXS_CH_API_ENTRY; |
| 967 | |
| 968 | #ifdef DXS_FEAT_UTD |
| 969 | ret = DXS_SIG_UtdDisable(pCh); |
| 970 | #endif /* DXS_FEAT_UTD */ |
| 971 | |
| 972 | DXS_API_EXIT(ret); |
| 973 | } |
| 974 | |
| 975 | /** |
| 976 | DTMF Receiver Coefficients |
| 977 | (requires --enable-dtmfd) |
| 978 | |
| 979 | \param dxs - device number |
| 980 | \param line - line number |
| 981 | \param level - minimum signal level |
| 982 | \param twist - maximum allowed twist |
| 983 | |
| 984 | \return |
| 985 | - DXS_statusOk or DXS_statusError |
| 986 | */ |
| 987 | int32_t DxsDtmfConfig(uint8_t dxs, uint8_t line, int16_t level, int16_t twist) |
| 988 | { |
| 989 | DXS_DEVICE_t *pDev; |
| 990 | DXS_CHANNEL_t *pCh; |
| 991 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 992 | |
| 993 | DXS_CH_API_ENTRY; |
| 994 | |
| 995 | #ifdef DXS_FEAT_DTMFD |
| 996 | ret = dxs_dtmf_config(pCh, level, twist); |
| 997 | #endif /* DXS_FEAT_DTMFD */ |
| 998 | |
| 999 | DXS_API_EXIT(ret); |
| 1000 | } |
| 1001 | |
| 1002 | /** |
| 1003 | DTMF Receiver Enable |
| 1004 | (requires --enable-dtmfd) |
| 1005 | |
| 1006 | \param dxs - device number |
| 1007 | \param line - line number |
| 1008 | |
| 1009 | \return |
| 1010 | - DXS_statusOk or DXS_statusError |
| 1011 | */ |
| 1012 | int32_t DxsDtmfEnable(uint8_t dxs, uint8_t line) |
| 1013 | { |
| 1014 | DXS_DEVICE_t *pDev; |
| 1015 | DXS_CHANNEL_t *pCh; |
| 1016 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1017 | |
| 1018 | DXS_CH_API_ENTRY; |
| 1019 | |
| 1020 | #ifdef DXS_FEAT_DTMFD |
| 1021 | ret = dxs_dtmf_enable(pCh, 1); |
| 1022 | #endif /* DXS_FEAT_DTMFD */ |
| 1023 | |
| 1024 | DXS_API_EXIT(ret); |
| 1025 | } |
| 1026 | |
| 1027 | /** |
| 1028 | DTMF Receiver Disable |
| 1029 | (requires --enable-dtmfd) |
| 1030 | |
| 1031 | \param dxs - device number |
| 1032 | \param line - line number |
| 1033 | |
| 1034 | \return |
| 1035 | - DXS_statusOk or DXS_statusError |
| 1036 | */ |
| 1037 | int32_t DxsDtmfDisable(uint8_t dxs, uint8_t line) |
| 1038 | { |
| 1039 | DXS_DEVICE_t *pDev; |
| 1040 | DXS_CHANNEL_t *pCh; |
| 1041 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1042 | |
| 1043 | DXS_CH_API_ENTRY; |
| 1044 | |
| 1045 | #ifdef DXS_FEAT_DTMFD |
| 1046 | ret = dxs_dtmf_enable(pCh, 0); |
| 1047 | #endif /* DXS_FEAT_DTMFD */ |
| 1048 | |
| 1049 | DXS_API_EXIT(ret); |
| 1050 | } |
| 1051 | |
| 1052 | /** |
| 1053 | Set GR-909 limits |
| 1054 | (requires --enable-gr909) |
| 1055 | |
| 1056 | \param dxs - device number |
| 1057 | \param line - line number |
| 1058 | \param pGR909Conf - pointer to SDD GR909 configuration structure |
| 1059 | |
| 1060 | \return |
| 1061 | - DXS_statusOk or DXS_statusError |
| 1062 | */ |
| 1063 | int32_t DxsGr909LimitsSet(uint8_t dxs, uint8_t line, |
| 1064 | DXS_GR909Config_t *pGR909Conf) |
| 1065 | { |
| 1066 | DXS_DEVICE_t *pDev; |
| 1067 | DXS_CHANNEL_t *pCh; |
| 1068 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1069 | |
| 1070 | DXS_CH_API_ENTRY; |
| 1071 | |
| 1072 | #ifdef DXS_FEAT_GR909 |
| 1073 | ret = DXS_SDD_GR909LimitsSet(pCh, pGR909Conf); |
| 1074 | #endif /* DXS_FEAT_GR909 */ |
| 1075 | |
| 1076 | DXS_API_EXIT(ret); |
| 1077 | } |
| 1078 | |
| 1079 | /** |
| 1080 | Get GR-909 limits |
| 1081 | (requires --enable-gr909) |
| 1082 | |
| 1083 | \param dxs - device number |
| 1084 | \param line - line number |
| 1085 | \param pGR909Conf - pointer to SDD GR909 configuration structure |
| 1086 | |
| 1087 | \return |
| 1088 | - DXS_statusOk or DXS_statusError |
| 1089 | */ |
| 1090 | int32_t DxsGr909LimitsGet(uint8_t dxs, uint8_t line, |
| 1091 | DXS_GR909Config_t *pGR909Conf) |
| 1092 | { |
| 1093 | DXS_DEVICE_t *pDev; |
| 1094 | DXS_CHANNEL_t *pCh; |
| 1095 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1096 | |
| 1097 | DXS_CH_API_ENTRY; |
| 1098 | |
| 1099 | #ifdef DXS_FEAT_GR909 |
| 1100 | ret = DXS_SDD_GR909LimitsGet(pCh, pGR909Conf); |
| 1101 | #endif /* DXS_FEAT_GR909 */ |
| 1102 | |
| 1103 | DXS_API_EXIT(ret); |
| 1104 | } |
| 1105 | |
| 1106 | /** |
| 1107 | Get GR-909 results |
| 1108 | (requires --enable-gr909) |
| 1109 | |
| 1110 | \param dxs - device number |
| 1111 | \param line - line number |
| 1112 | \param pGR909Result - pointer to SDD GR909 result structure |
| 1113 | |
| 1114 | \return |
| 1115 | - DXS_statusOk or DXS_statusError |
| 1116 | */ |
| 1117 | int32_t DxsGr909ResultGet(uint8_t dxs, uint8_t line, |
| 1118 | DXS_GR909Result_t *pGR909Result) |
| 1119 | { |
| 1120 | DXS_DEVICE_t *pDev; |
| 1121 | DXS_CHANNEL_t *pCh; |
| 1122 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1123 | |
| 1124 | DXS_CH_API_ENTRY; |
| 1125 | |
| 1126 | #ifdef DXS_FEAT_GR909 |
| 1127 | ret = DXS_SDD_GR909ResultGet(pCh, pGR909Result); |
| 1128 | #endif /* DXS_FEAT_GR909 */ |
| 1129 | |
| 1130 | DXS_API_EXIT(ret); |
| 1131 | } |
| 1132 | |
| 1133 | /** |
| 1134 | GPIO port configuration |
| 1135 | (requires --enable-gpio) |
| 1136 | |
| 1137 | \param dxs - device number |
| 1138 | \param pGpioConf - pointer to GPIO configuration structure |
| 1139 | |
| 1140 | \return |
| 1141 | - DXS_statusOk or DXS_statusError |
| 1142 | */ |
| 1143 | int32_t DxsGpioPortConfig(uint8_t dxs, DXS_GpioConfig_t *pGpioConf) |
| 1144 | { |
| 1145 | DXS_DEVICE_t *pDev; |
| 1146 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1147 | |
| 1148 | DXS_DEV_API_ENTRY; |
| 1149 | |
| 1150 | #ifdef DXS_FEAT_GPIO |
| 1151 | ret = DXS_GPIO_Config(pDev, pGpioConf); |
| 1152 | #endif /* DXS_FEAT_GPIO */ |
| 1153 | |
| 1154 | DXS_API_EXIT(ret); |
| 1155 | } |
| 1156 | |
| 1157 | /** |
| 1158 | GPIO write |
| 1159 | (requires --enable-gpio) |
| 1160 | |
| 1161 | \param dxs - device number |
| 1162 | \param pin - GPIO pin number |
| 1163 | \param val - value |
| 1164 | |
| 1165 | \return |
| 1166 | - DXS_statusOk or DXS_statusError |
| 1167 | */ |
| 1168 | int32_t DxsGpioWrite(uint8_t dxs, uint8_t pin, uint8_t val) |
| 1169 | { |
| 1170 | DXS_DEVICE_t *pDev; |
| 1171 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1172 | |
| 1173 | DXS_DEV_API_ENTRY; |
| 1174 | |
| 1175 | #ifdef DXS_FEAT_GPIO |
| 1176 | ret = DXS_GPIO_Write(pDev, pin, val); |
| 1177 | #endif /* DXS_FEAT_GPIO */ |
| 1178 | |
| 1179 | DXS_API_EXIT(ret); |
| 1180 | } |
| 1181 | |
| 1182 | /** |
| 1183 | GPIO read |
| 1184 | (requires --enable-gpio) |
| 1185 | |
| 1186 | \param dxs - device number |
| 1187 | \param pin - GPIO pin number |
| 1188 | \param *value - value |
| 1189 | |
| 1190 | \return |
| 1191 | - DXS_statusOk or DXS_statusError |
| 1192 | */ |
| 1193 | int32_t DxsGpioRead(uint8_t dxs, uint8_t pin, uint8_t *value) |
| 1194 | { |
| 1195 | DXS_DEVICE_t *pDev; |
| 1196 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1197 | |
| 1198 | DXS_DEV_API_ENTRY; |
| 1199 | |
| 1200 | #ifdef DXS_FEAT_GPIO |
| 1201 | ret = DXS_GPIO_Read(pDev, pin, value); |
| 1202 | #endif /* DXS_FEAT_GPIO */ |
| 1203 | |
| 1204 | DXS_API_EXIT(ret); |
| 1205 | } |
| 1206 | |
| 1207 | |
| 1208 | /** |
| 1209 | Read the results of calibration measurements. |
| 1210 | |
| 1211 | \param dxs - device number |
| 1212 | \param line - line number |
| 1213 | \param pCalibration - pointer to calibration structure |
| 1214 | |
| 1215 | \return |
| 1216 | - DXS_statusOk or DXS_statusError |
| 1217 | */ |
| 1218 | int32_t DxsCalibrationGet(uint8_t dxs, uint8_t line, |
| 1219 | DXS_Calibration_t *pCalibration) |
| 1220 | { |
| 1221 | DXS_DEVICE_t *pDev; |
| 1222 | DXS_CHANNEL_t *pCh; |
| 1223 | int32_t ret; |
| 1224 | |
| 1225 | DXS_CH_API_ENTRY; |
| 1226 | |
| 1227 | ret = DXS_SDD_CalibrationGet(pCh, pCalibration); |
| 1228 | |
| 1229 | DXS_API_EXIT(ret); |
| 1230 | } |
| 1231 | |
| 1232 | /** |
| 1233 | Write hardware configuration values. |
| 1234 | |
| 1235 | \param dxs - device number |
| 1236 | \param line - line number |
| 1237 | \param pCalibration - pointer to calibration structure |
| 1238 | |
| 1239 | \return |
| 1240 | - DXS_statusOk or DXS_statusError |
| 1241 | */ |
| 1242 | int32_t DxsCalibrationSet(uint8_t dxs, uint8_t line, |
| 1243 | DXS_Calibration_t *pCalibration) |
| 1244 | { |
| 1245 | DXS_DEVICE_t *pDev; |
| 1246 | DXS_CHANNEL_t *pCh; |
| 1247 | int32_t ret; |
| 1248 | |
| 1249 | DXS_CH_API_ENTRY; |
| 1250 | |
| 1251 | ret = DXS_SDD_CalibrationSet(pCh, pCalibration); |
| 1252 | |
| 1253 | DXS_API_EXIT(ret); |
| 1254 | } |
| 1255 | |
| 1256 | /** |
| 1257 | Sets the validation times for hook, pulse digit and flashhook. |
| 1258 | |
| 1259 | \param dxs - device number |
| 1260 | \param line - line number |
| 1261 | \param pTime - type of validation setting, min and max time in |
| 1262 | milliseconds. |
| 1263 | \return |
| 1264 | - DXS_statusOk or DXS_statusError |
| 1265 | */ |
| 1266 | int32_t DxsHookValTimeSet(uint8_t dxs, uint8_t line, DXS_HookValTime_t *pTime) |
| 1267 | { |
| 1268 | DXS_DEVICE_t *pDev; |
| 1269 | DXS_CHANNEL_t *pCh; |
| 1270 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1271 | |
| 1272 | DXS_CH_API_ENTRY; |
| 1273 | |
| 1274 | #ifdef DXS_FEAT_HSM |
| 1275 | ret = DXS_Dial_HookValTimeSet(pCh, pTime); |
| 1276 | #endif /* DXS_FEAT_HSM */ |
| 1277 | |
| 1278 | DXS_API_EXIT(ret); |
| 1279 | } |
| 1280 | |
| 1281 | /** |
| 1282 | Get capacitance measurement result |
| 1283 | |
| 1284 | \param dxs - device number |
| 1285 | \param line - line number |
| 1286 | \param pCapacitance - pointer to capacitance measurement structure |
| 1287 | |
| 1288 | \return |
| 1289 | - DXS_statusOk or DXS_statusError |
| 1290 | */ |
| 1291 | int32_t DxsCapMeasurementResultGet(uint8_t dxs, uint8_t line, |
| 1292 | DXS_Capacitance_t *pCapacitance) |
| 1293 | { |
| 1294 | DXS_DEVICE_t *pDev; |
| 1295 | DXS_CHANNEL_t *pCh; |
| 1296 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1297 | |
| 1298 | DXS_CH_API_ENTRY; |
| 1299 | |
| 1300 | #ifdef DXS_FEAT_CAPMEAS |
| 1301 | ret = DXS_SDD_CapMeasurementResultGet(pCh, 1, pCapacitance); |
| 1302 | #endif /* DXS_FEAT_CAPMEAS */ |
| 1303 | |
| 1304 | DXS_API_EXIT(ret); |
| 1305 | } |
| 1306 | |
| 1307 | /** |
| 1308 | Get continuous measurements result |
| 1309 | |
| 1310 | \param dxs - device number |
| 1311 | \param line - line number |
| 1312 | \param pResult - pointer to continuous measurement structure |
| 1313 | |
| 1314 | \return |
| 1315 | - DXS_statusOk or DXS_statusError |
| 1316 | */ |
| 1317 | int32_t DxsContMeasurementResultGet(uint8_t dxs, uint8_t line, |
| 1318 | DXS_ContMeasurementResult_t *pResult) |
| 1319 | { |
| 1320 | DXS_DEVICE_t *pDev; |
| 1321 | DXS_CHANNEL_t *pCh; |
| 1322 | int32_t ret; |
| 1323 | |
| 1324 | DXS_CH_API_ENTRY; |
| 1325 | |
| 1326 | ret = DXS_SDD_ContMeasurementResultGet(pCh, pResult); |
| 1327 | |
| 1328 | DXS_API_EXIT(ret); |
| 1329 | } |
| 1330 | |
| 1331 | /** |
| 1332 | Enable metering pulse. The pulse length can be programmed |
| 1333 | with SDD_BasicConfig. |
| 1334 | (requires --enable-metering) |
| 1335 | |
| 1336 | \param dxs - device number |
| 1337 | \param line - line number |
| 1338 | |
| 1339 | \return |
| 1340 | - DXS_statusOk or DXS_statusError |
| 1341 | */ |
| 1342 | int32_t DxsMeteringPulseEnable(uint8_t dxs, uint8_t line) |
| 1343 | { |
| 1344 | DXS_DEVICE_t *pDev; |
| 1345 | DXS_CHANNEL_t *pCh; |
| 1346 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1347 | |
| 1348 | DXS_CH_API_ENTRY; |
| 1349 | |
| 1350 | #ifdef DXS_FEAT_METERING |
| 1351 | ret = DXS_SIG_MeterPulseEnable(pCh); |
| 1352 | #endif /* DXS_FEAT_METERING */ |
| 1353 | |
| 1354 | DXS_API_EXIT(ret); |
| 1355 | } |
| 1356 | |
| 1357 | /** |
| 1358 | Disable metering pulse. |
| 1359 | (requires --enable-metering) |
| 1360 | |
| 1361 | \param dxs - device number |
| 1362 | \param line - line number |
| 1363 | |
| 1364 | \return |
| 1365 | - DXS_statusOk or DXS_statusError |
| 1366 | */ |
| 1367 | int32_t DxsMeteringPulseDisable(uint8_t dxs, uint8_t line) |
| 1368 | { |
| 1369 | DXS_DEVICE_t *pDev; |
| 1370 | DXS_CHANNEL_t *pCh; |
| 1371 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1372 | |
| 1373 | DXS_CH_API_ENTRY; |
| 1374 | |
| 1375 | #ifdef DXS_FEAT_METERING |
| 1376 | ret = DXS_SIG_MeterPulseDisable(pCh); |
| 1377 | #endif /* DXS_FEAT_METERING */ |
| 1378 | |
| 1379 | DXS_API_EXIT(ret); |
| 1380 | } |
| 1381 | |
| 1382 | /** |
| 1383 | Open Loop Calibration |
| 1384 | |
| 1385 | \param dxs - device number |
| 1386 | \param line - line number |
| 1387 | \param loops - number of loops |
| 1388 | \param pOLCalibrationResult - pointer to Open Loop Calibration structure |
| 1389 | |
| 1390 | \return |
| 1391 | - DXS_statusOk or DXS_statusError |
| 1392 | */ |
| 1393 | int32_t DxsOpenLoopCalibration(uint8_t dxs, uint8_t line, uint8_t loops, |
| 1394 | DXS_OLCalibration_t *pOLCalibrationResult) |
| 1395 | { |
| 1396 | DXS_DEVICE_t *pDev; |
| 1397 | DXS_CHANNEL_t *pCh; |
| 1398 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1399 | |
| 1400 | DXS_CH_API_ENTRY; |
| 1401 | |
| 1402 | #if defined(DXS_FEAT_CAPMEAS) && defined(DXS_FEAT_GR909) |
| 1403 | ret = DXS_SDD_OLCalibration(pCh, loops, pOLCalibrationResult); |
| 1404 | #endif /* DXS_FEAT_CAPMEAS && DXS_FEAT_GR909 */ |
| 1405 | |
| 1406 | DXS_API_EXIT(ret); |
| 1407 | } |
| 1408 | |
| 1409 | /** |
| 1410 | Function to set the Open Loop Calibration configuration |
| 1411 | |
| 1412 | \param dxs - device number |
| 1413 | \param line - line number |
| 1414 | \param pOLCalibration - pointer to Open Loop Calibration structure |
| 1415 | |
| 1416 | \return |
| 1417 | - DXS_statusOk or DXS_statusError |
| 1418 | */ |
| 1419 | int32_t DxsOpenLoopConfigSet(uint8_t dxs, uint8_t line, |
| 1420 | DXS_OLCalibration_t *pOLCalibration) |
| 1421 | { |
| 1422 | DXS_DEVICE_t *pDev; |
| 1423 | DXS_CHANNEL_t *pCh; |
| 1424 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1425 | |
| 1426 | DXS_CH_API_ENTRY; |
| 1427 | |
| 1428 | #if defined(DXS_FEAT_CAPMEAS) && defined(DXS_FEAT_GR909) |
| 1429 | ret = DXS_SDD_OLCalibrationConfigSet(pCh, pOLCalibration); |
| 1430 | #endif /* DXS_FEAT_CAPMEAS && DXS_FEAT_GR909 */ |
| 1431 | |
| 1432 | DXS_API_EXIT(ret); |
| 1433 | } |
| 1434 | |
| 1435 | /** |
| 1436 | Function to get the Open Loop Calibration configuration |
| 1437 | |
| 1438 | \param dxs - device number |
| 1439 | \param line - line number |
| 1440 | \param pOLCalibration - pointer to Open Loop Calibration structure |
| 1441 | |
| 1442 | \return |
| 1443 | - DXS_statusOk or DXS_statusError |
| 1444 | */ |
| 1445 | int32_t DxsOpenLoopConfigGet(uint8_t dxs, uint8_t line, |
| 1446 | DXS_OLCalibration_t *pOLCalibration) |
| 1447 | { |
| 1448 | DXS_DEVICE_t *pDev; |
| 1449 | DXS_CHANNEL_t *pCh; |
| 1450 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1451 | |
| 1452 | DXS_CH_API_ENTRY; |
| 1453 | |
| 1454 | #if defined(DXS_FEAT_CAPMEAS) && defined(DXS_FEAT_GR909) |
| 1455 | ret = DXS_SDD_OLCalibrationConfigGet(pCh, pOLCalibration); |
| 1456 | #endif /* DXS_FEAT_CAPMEAS && DXS_FEAT_GR909 */ |
| 1457 | |
| 1458 | DXS_API_EXIT(ret); |
| 1459 | } |
| 1460 | |
| 1461 | /** |
| 1462 | Function to start the ACLM measurement |
| 1463 | |
| 1464 | \param dxs - device number |
| 1465 | \param line - line number |
| 1466 | \param aclm_mt - ACLM measurment code |
| 1467 | |
| 1468 | \return |
| 1469 | - \ref DXS_status_t code |
| 1470 | */ |
| 1471 | int32_t DxsAcLmMeasurementStart(uint8_t dxs, uint8_t line, |
| 1472 | DXS_ACLM_Measurement_t aclm_mt) |
| 1473 | { |
| 1474 | DXS_DEVICE_t *pDev; |
| 1475 | DXS_CHANNEL_t *pCh; |
| 1476 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1477 | |
| 1478 | DXS_CH_API_ENTRY; |
| 1479 | |
| 1480 | #ifdef DXS_FEAT_ACMETER |
| 1481 | ret = DXS_SDD_ACLM_Start(pCh, aclm_mt); |
| 1482 | #endif /* DXS_FEAT_ACMETER */ |
| 1483 | |
| 1484 | DXS_API_EXIT(ret); |
| 1485 | } |
| 1486 | |
| 1487 | /** |
| 1488 | Function to retrieve the available ACLM measurement result number |
| 1489 | |
| 1490 | \param dxs - device number |
| 1491 | \param line - line number |
| 1492 | \param aclm_mt - ACLM measurment code |
| 1493 | \param pResNum - ACLM result number (output) |
| 1494 | |
| 1495 | \return |
| 1496 | - \ref DXS_status_t code |
| 1497 | */ |
| 1498 | int32_t DxsAcLmMeasResNumGet(uint8_t dxs, uint8_t line, |
| 1499 | DXS_ACLM_Measurement_t aclm_mt, |
| 1500 | int32_t *pResNum) |
| 1501 | { |
| 1502 | DXS_DEVICE_t *pDev; |
| 1503 | DXS_CHANNEL_t *pCh; |
| 1504 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1505 | |
| 1506 | DXS_CH_API_ENTRY; |
| 1507 | |
| 1508 | #ifdef DXS_FEAT_ACMETER |
| 1509 | ret = DXS_SDD_ACLM_ResultGet(pCh, |
| 1510 | aclm_mt, DXS_ACLM_RESULT_NUMBER, 0, pResNum); |
| 1511 | #endif /* DXS_FEAT_ACMETER */ |
| 1512 | |
| 1513 | DXS_API_EXIT(ret); |
| 1514 | } |
| 1515 | |
| 1516 | /** |
| 1517 | Function to retrieve the argument of particular ACLM measurement index |
| 1518 | |
| 1519 | \param dxs - device number |
| 1520 | \param line - line number |
| 1521 | \param aclm_mt - ACLM measurment code |
| 1522 | \param index - ACLM measurment index |
| 1523 | \param pResArg - ACLM result argument (output) |
| 1524 | |
| 1525 | \return |
| 1526 | - \ref DXS_status_t code |
| 1527 | */ |
| 1528 | int32_t DxsAcLmMeasResArgGet(uint8_t dxs, uint8_t line, |
| 1529 | DXS_ACLM_Measurement_t aclm_mt, |
| 1530 | int32_t index, int32_t *pResArg) |
| 1531 | { |
| 1532 | DXS_DEVICE_t *pDev; |
| 1533 | DXS_CHANNEL_t *pCh; |
| 1534 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1535 | |
| 1536 | DXS_CH_API_ENTRY; |
| 1537 | |
| 1538 | #ifdef DXS_FEAT_ACMETER |
| 1539 | ret = DXS_SDD_ACLM_ResultGet(pCh, |
| 1540 | aclm_mt, DXS_ACLM_RESULT_ARG, index, pResArg); |
| 1541 | #endif /* DXS_FEAT_ACMETER */ |
| 1542 | |
| 1543 | DXS_API_EXIT(ret); |
| 1544 | } |
| 1545 | |
| 1546 | /** |
| 1547 | Function to retrieve the result value of particular ACLM measurement index |
| 1548 | |
| 1549 | \param dxs - device number |
| 1550 | \param line - line number |
| 1551 | \param aclm_mt - ACLM measurment code |
| 1552 | \param index - ACLM measurment index |
| 1553 | \param pResArg - ACLM result argument (output) |
| 1554 | |
| 1555 | \return |
| 1556 | - \ref DXS_status_t code |
| 1557 | */ |
| 1558 | int32_t DxsAcLmMeasResValGet(uint8_t dxs, uint8_t line, |
| 1559 | DXS_ACLM_Measurement_t aclm_mt, |
| 1560 | int32_t index, int32_t *pResVal) |
| 1561 | { |
| 1562 | DXS_DEVICE_t *pDev; |
| 1563 | DXS_CHANNEL_t *pCh; |
| 1564 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1565 | |
| 1566 | DXS_CH_API_ENTRY; |
| 1567 | |
| 1568 | #ifdef DXS_FEAT_ACMETER |
| 1569 | ret = DXS_SDD_ACLM_ResultGet(pCh, |
| 1570 | aclm_mt, DXS_ACLM_RESULT_VALUE, index, pResVal); |
| 1571 | #endif /* DXS_FEAT_ACMETER */ |
| 1572 | |
| 1573 | DXS_API_EXIT(ret); |
| 1574 | } |
| 1575 | |
| 1576 | /** |
| 1577 | Function to initialize CID interface for a channel |
| 1578 | |
| 1579 | \param dxs - device number |
| 1580 | \param line - line number |
| 1581 | \param std - CID standard |
| 1582 | \param as - CID alert signal |
| 1583 | \param fmt - CID data format |
| 1584 | \param dtmf_ack_idx - DTMF index for acknowledgment (type2) |
| 1585 | |
| 1586 | \return |
| 1587 | - \ref DXS_status_t code |
| 1588 | */ |
| 1589 | int32_t DxsCidInit (uint8_t dxs, uint8_t line, DXS_CID_Std_t std, |
| 1590 | DXS_CID_AS_t as, DXS_CID_DATA_FMT_t fmt, uint8_t dtmf_ack_idx) |
| 1591 | { |
| 1592 | DXS_DEVICE_t *pDev; |
| 1593 | DXS_CHANNEL_t *pCh; |
| 1594 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1595 | |
| 1596 | DXS_CH_API_ENTRY; |
| 1597 | |
| 1598 | #ifdef DXS_FEAT_CID |
| 1599 | ret = DXS_CID_Init(pCh, std, as, fmt, dtmf_ack_idx); |
| 1600 | #endif /* DXS_FEAT_CID */ |
| 1601 | |
| 1602 | DXS_API_EXIT(ret); |
| 1603 | } |
| 1604 | |
| 1605 | /** |
| 1606 | Function to configure timers for a given CID standard. |
| 1607 | |
| 1608 | \param dxs - device number |
| 1609 | \param line - line number |
| 1610 | \param std - CID standard |
| 1611 | \param pTimers - pointer to timer union |
| 1612 | |
| 1613 | \return |
| 1614 | - \ref DXS_status_t code |
| 1615 | */ |
| 1616 | int32_t DxsCidTimerConfig (uint8_t dxs, uint8_t line, DXS_CID_Std_t std, |
| 1617 | DXS_CID_Timers_t *pTimers) |
| 1618 | { |
| 1619 | DXS_DEVICE_t *pDev; |
| 1620 | DXS_CHANNEL_t *pCh; |
| 1621 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1622 | |
| 1623 | DXS_CH_API_ENTRY; |
| 1624 | |
| 1625 | #ifdef DXS_FEAT_CID |
| 1626 | ret = DXS_CID_TimerConfig(pCh, std, pTimers); |
| 1627 | #endif /* DXS_FEAT_CID */ |
| 1628 | |
| 1629 | DXS_API_EXIT(ret); |
| 1630 | } |
| 1631 | |
| 1632 | /** |
| 1633 | Function to create (or update) the CID message per channel |
| 1634 | |
| 1635 | \param dxs - device number |
| 1636 | \param line - line number |
| 1637 | \param msg_type - CID message type |
| 1638 | \param param - CID message parameter |
| 1639 | \param pData - pointer to char data of the parameter value |
| 1640 | \param length - length of the data pointed by pData |
| 1641 | |
| 1642 | \return |
| 1643 | - \ref DXS_status_t code |
| 1644 | */ |
| 1645 | int32_t DxsCidMsgSetup(uint8_t dxs, uint8_t line, DXS_CID_MsgType_t msg_type, |
| 1646 | DXS_CID_MsgParam_t param, char *pData, uint8_t length) |
| 1647 | { |
| 1648 | DXS_DEVICE_t *pDev; |
| 1649 | DXS_CHANNEL_t *pCh; |
| 1650 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1651 | |
| 1652 | DXS_CH_API_ENTRY; |
| 1653 | |
| 1654 | #ifdef DXS_FEAT_CID |
| 1655 | ret = DXS_CID_MsgUpdate(pCh, msg_type, param, pData, length); |
| 1656 | #endif /* DXS_FEAT_CID */ |
| 1657 | |
| 1658 | DXS_API_EXIT(ret); |
| 1659 | } |
| 1660 | |
| 1661 | /** |
| 1662 | Function to delete entirely the CID message per channel |
| 1663 | |
| 1664 | \param dxs - device number |
| 1665 | \param line - line number |
| 1666 | |
| 1667 | \return |
| 1668 | - \ref DXS_status_t code |
| 1669 | */ |
| 1670 | int32_t DxsCidMsgReset(uint8_t dxs, uint8_t line) |
| 1671 | { |
| 1672 | DXS_DEVICE_t *pDev; |
| 1673 | DXS_CHANNEL_t *pCh; |
| 1674 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1675 | |
| 1676 | DXS_CH_API_ENTRY; |
| 1677 | |
| 1678 | #ifdef DXS_FEAT_CID |
| 1679 | ret = DXS_CID_MsgCleanup(pCh); |
| 1680 | #endif /* DXS_FEAT_CID */ |
| 1681 | |
| 1682 | DXS_API_EXIT(ret); |
| 1683 | } |
| 1684 | |
| 1685 | /** |
| 1686 | Function to start the playout of CID TypeI sequence |
| 1687 | |
| 1688 | \param dxs - device number |
| 1689 | \param line - line number |
| 1690 | \param std - CID standard |
| 1691 | \param as - Alert signal |
| 1692 | \param fmt - Data format |
| 1693 | \param msg_type - message type selected for playout |
| 1694 | |
| 1695 | \return |
| 1696 | - \ref DXS_status_t code |
| 1697 | */ |
| 1698 | int32_t DxsCidTypeIMsgStart(uint8_t dxs, uint8_t line, |
| 1699 | DXS_CID_MsgType_t msg_type) |
| 1700 | { |
| 1701 | DXS_DEVICE_t *pDev; |
| 1702 | DXS_CHANNEL_t *pCh; |
| 1703 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1704 | |
| 1705 | DXS_CH_API_ENTRY; |
| 1706 | |
| 1707 | #ifdef DXS_FEAT_CID |
| 1708 | ret = DXS_CID_TypeI_Play(pCh, msg_type, DXS_CID_CALL_FROM_CID_API); |
| 1709 | #endif /* DXS_FEAT_CID */ |
| 1710 | |
| 1711 | DXS_API_EXIT(ret); |
| 1712 | } |
| 1713 | |
| 1714 | /** |
| 1715 | Function to start the playout of CID TypeII sequence |
| 1716 | |
| 1717 | \param dxs - device number |
| 1718 | \param line - line number |
| 1719 | \param std - CID standard |
| 1720 | \param as - Alert signal |
| 1721 | \param fmt - Data format |
| 1722 | \param msg_type - message type selected for playout |
| 1723 | |
| 1724 | \return |
| 1725 | - \ref DXS_status_t code |
| 1726 | */ |
| 1727 | int32_t DxsCidTypeIIMsgStart(uint8_t dxs, uint8_t line, |
| 1728 | DXS_CID_MsgType_t msg_type) |
| 1729 | { |
| 1730 | DXS_DEVICE_t *pDev; |
| 1731 | DXS_CHANNEL_t *pCh; |
| 1732 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1733 | |
| 1734 | DXS_CH_API_ENTRY; |
| 1735 | |
| 1736 | #ifdef DXS_FEAT_CID |
| 1737 | ret = DXS_CID_TypeII_Play(pCh, msg_type); |
| 1738 | #endif /* DXS_FEAT_CID */ |
| 1739 | |
| 1740 | DXS_API_EXIT(ret); |
| 1741 | } |
| 1742 | |
| 1743 | /** |
| 1744 | Function to stop the playout of CID sequence |
| 1745 | |
| 1746 | \param dxs - device number |
| 1747 | \param line - line number |
| 1748 | |
| 1749 | \return |
| 1750 | - \ref DXS_status_t code |
| 1751 | */ |
| 1752 | int32_t DxsCidSeqStop(uint8_t dxs, uint8_t line) |
| 1753 | { |
| 1754 | DXS_DEVICE_t *pDev; |
| 1755 | DXS_CHANNEL_t *pCh; |
| 1756 | int32_t ret = DXS_statusFeatNotCompiledIn; |
| 1757 | |
| 1758 | DXS_CH_API_ENTRY; |
| 1759 | |
| 1760 | #ifdef DXS_FEAT_CID |
| 1761 | ret = DXS_CID_Stop(pCh); |
| 1762 | #endif /* DXS_FEAT_CID */ |
| 1763 | |
| 1764 | DXS_API_EXIT(ret); |
| 1765 | } |
| 1766 | |
| 1767 | /** |
| 1768 | Function to configure the ringing cadence |
| 1769 | |
| 1770 | \param dxs - device number |
| 1771 | \param line - line number |
| 1772 | \param pRC - pointer to \ref DXS_RingCadence_t structure |
| 1773 | |
| 1774 | \return |
| 1775 | - \ref DXS_status_t code |
| 1776 | */ |
| 1777 | int32_t DxsRingCadenceInit(uint8_t dxs, uint8_t line, DXS_RingCadence_t *pRC) |
| 1778 | { |
| 1779 | DXS_DEVICE_t *pDev; |
| 1780 | DXS_CHANNEL_t *pCh; |
| 1781 | int32_t ret; |
| 1782 | |
| 1783 | DXS_CH_API_ENTRY; |
| 1784 | |
| 1785 | ret = DXS_RING_CadenceInit(pCh, pRC); |
| 1786 | |
| 1787 | DXS_API_EXIT(ret); |
| 1788 | } |
| 1789 | |
| 1790 | /** |
| 1791 | Function to start the ringing cadence |
| 1792 | |
| 1793 | \param dxs - device number |
| 1794 | \param line - line number |
| 1795 | |
| 1796 | \return |
| 1797 | - \ref DXS_status_t code |
| 1798 | */ |
| 1799 | int32_t DxsRingCadenceStart(uint8_t dxs, uint8_t line) |
| 1800 | { |
| 1801 | DXS_DEVICE_t *pDev; |
| 1802 | DXS_CHANNEL_t *pCh; |
| 1803 | int32_t ret; |
| 1804 | |
| 1805 | DXS_CH_API_ENTRY; |
| 1806 | |
| 1807 | ret = DXS_RING_CadenceStart(pCh); |
| 1808 | |
| 1809 | DXS_API_EXIT(ret); |
| 1810 | } |
| 1811 | |
| 1812 | /** |
| 1813 | Function to stop the ringing cadence |
| 1814 | |
| 1815 | \param dxs - device number |
| 1816 | \param line - line number |
| 1817 | |
| 1818 | \return |
| 1819 | - \ref DXS_status_t code |
| 1820 | */ |
| 1821 | int32_t DxsRingCadenceStop(uint8_t dxs, uint8_t line) |
| 1822 | { |
| 1823 | DXS_DEVICE_t *pDev; |
| 1824 | DXS_CHANNEL_t *pCh; |
| 1825 | int32_t ret; |
| 1826 | |
| 1827 | DXS_CH_API_ENTRY; |
| 1828 | |
| 1829 | ret = DXS_RING_CadenceStop(pCh); |
| 1830 | |
| 1831 | DXS_API_EXIT(ret); |
| 1832 | } |
| 1833 | |
| 1834 | /** |
| 1835 | Prevent ESD mode and line voltage drop |
| 1836 | on PCM clock failure |
| 1837 | |
| 1838 | \param dxs - device number |
| 1839 | |
| 1840 | \return |
| 1841 | - DXS_statusOk or DXS_statusError |
| 1842 | */ |
| 1843 | int32_t DxsClockFailLineFeedFreeze (uint8_t dxs) |
| 1844 | { |
| 1845 | DXS_DEVICE_t *pDev; |
| 1846 | int32_t ret; |
| 1847 | |
| 1848 | DXS_DEV_API_ENTRY; |
| 1849 | |
| 1850 | ret = DXS_CfEsdSwitch(pDev, 0); |
| 1851 | |
| 1852 | DXS_API_EXIT(ret); |
| 1853 | } |
| 1854 | |
| 1855 | /** |
| 1856 | Allow ESD mode and line voltage drop |
| 1857 | on PCM clock failure |
| 1858 | |
| 1859 | \param dxs - device number |
| 1860 | |
| 1861 | \return |
| 1862 | - DXS_statusOk or DXS_statusError |
| 1863 | */ |
| 1864 | int32_t DxsClockFailLineFeedUnFreeze (uint8_t dxs) |
| 1865 | { |
| 1866 | DXS_DEVICE_t *pDev; |
| 1867 | int32_t ret; |
| 1868 | |
| 1869 | DXS_DEV_API_ENTRY; |
| 1870 | |
| 1871 | ret = DXS_CfEsdSwitch(pDev, 1); |
| 1872 | |
| 1873 | DXS_API_EXIT(ret); |
| 1874 | } |
| 1875 | |
| 1876 | /* =================== MULTI-CHANNEL SHARED HW SUPPORT ====================== */ |
| 1877 | |
| 1878 | /** |
| 1879 | Configure the driver for the master channel. |
| 1880 | |
| 1881 | \param dxs - device number |
| 1882 | \param line - line number |
| 1883 | |
| 1884 | \return |
| 1885 | - DXS_statusOk |
| 1886 | - DXS_statusDevNotFound |
| 1887 | - DXS_statusDevNotInitialized |
| 1888 | - DXS_statusChannelNotFound |
| 1889 | - DXS_statusInvalidParam |
| 1890 | */ |
| 1891 | int32_t DxsSharedDcDcMasterSet (uint8_t dxs, uint8_t line) |
| 1892 | { |
| 1893 | DXS_DEVICE_t *pDev; |
| 1894 | DXS_CHANNEL_t *pCh; |
| 1895 | int32_t ret; |
| 1896 | |
| 1897 | DXS_CH_API_ENTRY; |
| 1898 | |
| 1899 | ret = DXS_DCDC_HW_SharedDcDcMasterChSet(pCh); |
| 1900 | |
| 1901 | DXS_API_EXIT(ret); |
| 1902 | } |
| 1903 | /* ========================================================================== */ |
| 1904 | |
| 1905 | /* ===================== E V E N T S U P P O R T ========================== */ |
| 1906 | |
| 1907 | /** |
| 1908 | Initialize Waiting List |
| 1909 | |
| 1910 | \return |
| 1911 | - waiting list instance |
| 1912 | */ |
| 1913 | DXS_WaitList_t DxsWaitListInit(void) |
| 1914 | { |
| 1915 | return dxs_wl_init(); |
| 1916 | } |
| 1917 | |
| 1918 | /** |
| 1919 | Initialize Waiting List |
| 1920 | |
| 1921 | \param wl - waiting list instance |
| 1922 | |
| 1923 | */ |
| 1924 | void DxsWaitListDestroy(DXS_WaitList_t wl) |
| 1925 | { |
| 1926 | dxs_wl_destroy(wl); |
| 1927 | } |
| 1928 | |
| 1929 | /** |
| 1930 | Add device to the waiting list |
| 1931 | |
| 1932 | \param dxs - device number |
| 1933 | \param wl - waiting list instance |
| 1934 | |
| 1935 | \return |
| 1936 | - DXS_statusOk or DXS_statusError |
| 1937 | */ |
| 1938 | int32_t DxsWaitListDevAdd(uint8_t dxs, DXS_WaitList_t wl) |
| 1939 | { |
| 1940 | DXS_DEVICE_t *pDev; |
| 1941 | int32_t ret; |
| 1942 | |
| 1943 | DXS_DEV_API_ENTRY; |
| 1944 | |
| 1945 | ret = dxs_wl_dev_add(pDev, wl); |
| 1946 | |
| 1947 | DXS_API_EXIT(ret); |
| 1948 | } |
| 1949 | |
| 1950 | /** |
| 1951 | Remove device from the waiting list |
| 1952 | |
| 1953 | \param dxs - device number |
| 1954 | \param wl - waiting list instance |
| 1955 | |
| 1956 | \return |
| 1957 | - DXS_statusOk or DXS_statusError |
| 1958 | */ |
| 1959 | int32_t DxsWaitListDevRemove(uint8_t dxs, DXS_WaitList_t wl) |
| 1960 | { |
| 1961 | DXS_DEVICE_t *pDev; |
| 1962 | int32_t ret; |
| 1963 | |
| 1964 | DXS_DEV_API_ENTRY; |
| 1965 | |
| 1966 | ret = dxs_wl_dev_remove(pDev, wl); |
| 1967 | |
| 1968 | DXS_API_EXIT(ret); |
| 1969 | } |
| 1970 | |
| 1971 | /** |
| 1972 | Wait on the Waiting List instance |
| 1973 | |
| 1974 | \param wl - waiting list instance |
| 1975 | |
| 1976 | \return |
| 1977 | - the first device number on the Waiting List |
| 1978 | having non-empty event queue |
| 1979 | or negative value in case of error |
| 1980 | */ |
| 1981 | int32_t DxsWaitForEvent(DXS_WaitList_t wl) |
| 1982 | { |
| 1983 | return dxs_wait(wl); |
| 1984 | } |
| 1985 | |
| 1986 | /** |
| 1987 | Read a single event from the device |
| 1988 | |
| 1989 | \param dxs - device number |
| 1990 | \param pEvent - pointer to DXS_Event_t structure |
| 1991 | |
| 1992 | \return |
| 1993 | - the remaining event count in device event queue |
| 1994 | or negative value in case of error |
| 1995 | */ |
| 1996 | int32_t DxsEventGet(uint8_t dxs, DXS_Event_t *pEvent) |
| 1997 | { |
| 1998 | DXS_DEVICE_t *pDev; |
| 1999 | |
| 2000 | DXS_DEV_API_ENTRY; |
| 2001 | |
| 2002 | /* no DXS_API_EXIT macro, as the function returns |
| 2003 | the event count instead of a status code */ |
| 2004 | |
| 2005 | return dxs_event_get(pDev, pEvent); |
| 2006 | } |
| 2007 | |
| 2008 | /** |
| 2009 | Enable dispatching of a particular event on a given line |
| 2010 | to the application. |
| 2011 | |
| 2012 | \param dxs Device number. |
| 2013 | \param line Line number. |
| 2014 | \param event Event id |
| 2015 | |
| 2016 | \return |
| 2017 | Return value according to \ref DXS_status_t. |
| 2018 | */ |
| 2019 | int32_t DxsEventEnable(uint8_t dxs, uint8_t line, DXS_Event_id_t event) |
| 2020 | { |
| 2021 | DXS_DEVICE_t *pDev; |
| 2022 | DXS_CHANNEL_t *pCh; |
| 2023 | int32_t ret; |
| 2024 | |
| 2025 | DXS_CH_API_ENTRY; |
| 2026 | |
| 2027 | ret = DXS_EventEnable(pCh, event); |
| 2028 | |
| 2029 | DXS_API_EXIT(ret); |
| 2030 | } |
| 2031 | |
| 2032 | /** |
| 2033 | Disable dispatching of a particular event on a given line |
| 2034 | to the application. |
| 2035 | |
| 2036 | \param dxs Device number. |
| 2037 | \param line Line number. |
| 2038 | \param event Event id |
| 2039 | |
| 2040 | \return |
| 2041 | Return value according to \ref DXS_status_t. |
| 2042 | */ |
| 2043 | int32_t DxsEventDisable(uint8_t dxs, uint8_t line, DXS_Event_id_t event) |
| 2044 | { |
| 2045 | DXS_DEVICE_t *pDev; |
| 2046 | DXS_CHANNEL_t *pCh; |
| 2047 | int32_t ret; |
| 2048 | |
| 2049 | DXS_CH_API_ENTRY; |
| 2050 | |
| 2051 | ret = DXS_EventDisable(pCh, event); |
| 2052 | |
| 2053 | DXS_API_EXIT(ret); |
| 2054 | } |
| 2055 | |
| 2056 | /* ========================================================================== */ |