blob: a85c3426e63d1cb162457417b615f87299d58328 [file] [log] [blame]
developere0cea0f2021-12-16 16:08:26 +08001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Distributed by:
4 * Silicon Laboratories, Inc
5 *
6 * This file contains proprietary information.
7 * No dissemination allowed without prior written permission from
8 * Silicon Laboratories, Inc.
9 *
10 * File Description:
11 * This is the header file for the ProSLIC driver.
12 *
13 */
14
15#ifndef PROSLIC_H
16#define PROSLIC_H
17
18/*include all the required headers*/
19#include "../config_inc/proslic_api_config.h"
20#include "../config_inc/si_voice_datatypes.h"
21#include "../inc/si_voice_ctrl.h"
22#include "../inc/si_voice_timer_intf.h"
23#include "../inc/si_voice.h"
24
25
26/* UNSORTED ADDITIONS - These common parameters have been moved from
27 the drivers to here to support simultaneous compile of multiple devices
28 */
29/* Patch Parameters */
30#define PATCH_NUM_LOW_ENTRIES 8
31#define PATCH_NUM_HIGH_ENTRIES 8
32#define PATCH_MAX_SUPPORT_RAM 128
33#define PATCH_MAX_SIZE 1024
34
35#define PROSLIC_RAM_MADC_VBAT 3
36#define PROSLIC_RAM_PATCHID 448
37#define PROSLIC_RAM_VERIFY_IO 449
38#define PROSLIC_RAM_PD_DCDC 1538
39#define PROSLIC_RAM_PRAM_ADDR 1358
40#define PROSLIC_RAM_PRAM_DATA 1359
41#define PATCH_JMPTBL_HIGH_ADDR 1597
42
43/* Common register values for 17x, 26x, 18x, 19x & 28x */
44#define PROSLIC_REG_ID 0
45#define PROSLIC_REG_RESET 1
46#define PROSLIC_REG_MSTRSTAT 3
47#define PROSLIC_REG_RAM_ADDR_HI 5
48#define PROSLIC_REG_PCMMODE 11
49#define PROSLIC_REG_PCMTXLO 12
50#define PROSLIC_REG_PCMTXHI 13
51#define PROSLIC_REG_PCMRXLO 14
52#define PROSLIC_REG_PCMRXHI 15
53#define PROSLIC_REG_IRQ 16
54#define PROSLIC_REG_IRQ0 17
55#define PROSLIC_REG_IRQ1 18
56#define PROSLIC_REG_IRQ4 21
57#define PROSLIC_REG_IRQEN1 22
58#define PROSLIC_REG_IRQEN2 23
59#define PROSLIC_REG_IRQEN3 24
60#define PROSLIC_REG_IRQEN4 25
61#define PROSLIC_REG_CALR0 26
62#define PROSLIC_REG_CALR3 29
63#define PROSLIC_REG_LINEFEED 30
64#define PROSLIC_REG_POLREV 31
65#define PROSLIC_REG_LCRRTP 34
66#define PROSLIC_REG_RINGCON 38
67#define PROSLIC_REG_RINGTALO 39
68#define PROSLIC_REG_RINGTAHI 40
69#define PROSLIC_REG_RINGTILO 41
70#define PROSLIC_REG_RINGTIHI 42
71#define PROSLIC_REG_LOOPBACK 43
72#define PROSLIC_REG_DIGCON 44
73#define PROSLIC_REG_ZCAL_EN 46
74#define PROSLIC_REG_ENHANCE 47
75#define PROSLIC_REG_OMODE 48
76#define PROSLIC_REG_OCON 49
77#define PROSLIC_REG_O1TALO 50
78#define PROSLIC_REG_O1TAHI 51
79#define PROSLIC_REG_O1TILO 52
80#define PROSLIC_REG_O1TIHI 53
81#define PROSLIC_REG_O2TALO 54
82#define PROSLIC_REG_O2TAHI 55
83#define PROSLIC_REG_O2TILO 56
84#define PROSLIC_REG_O2TIHI 57
85#define PROSLIC_REG_FSKDAT 58
86#define PROSLIC_REG_FSKDEPTH 59
87#define PROSLIC_REG_TONDTMF 60
88#define PROSLIC_REG_USERSTAT 66
89#define PROSLIC_REG_GPIO 67
90#define PROSLIC_REG_PMCON 75
91#define PROSLIC_REG_AUTORD 80
92#define PROSLIC_REG_JMPEN 81
93#define PATCH_JMPTBL_START_ADDR 82
94#define PATCH_JMPTBL_LOW_ADDR 82
95#define PROSLIC_REG_USERMODE_ENABLE 126
96
97/* Common RAM locations for most ProSLICs */
98#define PROSLIC_RAM_OSC1FREQ 26
99#define PROSLIC_RAM_OSC1AMP 27
100#define PROSLIC_RAM_OSC1PHAS 28
101#define PROSLIC_RAM_OSC2FREQ 29
102#define PROSLIC_RAM_OSC2AMP 30
103#define PROSLIC_RAM_OSC2PHAS 31
104#define PROSLIC_RAM_SLOPE_RING 637
105#define PROSLIC_RAM_V_VLIM 640
106#define PROSLIC_RAM_VOV_RING_BAT 753
107#define PROSLIC_RAM_RTPER 755
108#define PROSLIC_RAM_VBATR_EXPECT 768
109#define PROSLIC_RAM_FSKFREQ0 834
110#define PROSLIC_RAM_FSKFREQ1 835
111#define PROSLIC_RAM_FSKAMP0 836
112#define PROSLIC_RAM_FSKAMP1 837
113#define PROSLIC_RAM_FSK01 838
114#define PROSLIC_RAM_FSK10 839
115#define PROSLIC_RAM_RINGOF 843
116#define PROSLIC_RAM_RINGFR 844
117#define PROSLIC_RAM_RINGAMP 845
118#define PROSLIC_RAM_RTDCTH 847
119#define PROSLIC_RAM_RTACTH 848
120#define PROSLIC_RAM_RTDCDB 849
121#define PROSLIC_RAM_LCRMASK 854
122#define PROSLIC_RAM_IRING_LIM 860
123#define PROSLIC_RAM_VOV_RING_GND 896
124#define PROSLIC_RAM_MWI_V 914
125#define PROSLIC_RAM_DCDC_OITHRESH_LO 1006
126#define PROSLIC_RAM_DCDC_OITHRESH_HI 1007
127#define PROSLIC_RAM_CMDAC_FWD 1476
128#define PROSLIC_RAM_CMDAC_REV 1477
129#define PROSLIC_RAM_CAL_TRNRD_DACT 1458
130#define PROSLIC_RAM_CAL_TRNRD_DACR 1459
131#define PROSLIC_RAM_RDC_SUM 1499
132#define PROSLIC_RAM_DCDC_STATUS 1551
133#define PROSLIC_RAM_DCDC_RNGTYPE 1560
134
135#define PROSLIC_CHAN_BROADCAST 0xFF
136
137/* BOM Constants */
138#define BOM_KAUDIO_PM 0x8000000L
139#define BOM_KAUDIO_NO_PM 0x3A2E8BAL
140#define BOM_AC_ADC_GAIN_PM 0x151EB80L
141#define BOM_AC_ADC_GAIN_NO_PM 0x99999AL
142#define FIXRL_VDC_SCALE 0xAE924B9L /** vdc sense scale when using fixed-rail */
143
144/* Generic Constants */
145#define COMP_5V 0x51EB82L
146#define VBATL_13V 0xF00000L
147#define COMP_10V 0xA3D705L
148#define ZCAL_V_RASUM_IDEAL_VAL 0x8F00000L
149#define ZCAL_DC_DAC_OS_VAL 0x1FFE0000L
150
151/* MADC Constants */
152#define SCALE_V_MADC 1074 /* 1/(1000*931.32e-9) mV */
153#define SCALE_I_MADC 597 /* 1/(1e6*1.676e-9) uA */
154#define SCALE_P_MADC 2386 /* 1/(1e3*419.095e-9) mW */
155#define SCALE_R_MADC 1609 /* 1/(1e3*621.554e-9) mV */
156
157/* Calibration Constants */
158#define CAL_LB_CMDAC 0x0C
159#define CAL_LB_TRNRD 0x03
160#define CAL_LB_ALL 0x0F
161#define TIMEOUT_MADC_CAL 100
162#define TIMEOUT_GEN_CAL 300
163#define TIMEOUT_LB_CAL 2410
164
165/* MWI Constants */
166#define SIL_MWI_USTAT_SET 0x04
167#define SIL_MWI_USTAT_CLEAR 0xFB
168#define SIL_MWI_VPK_MAX 110
169#define SIL_MWI_VPK_MAX_LO 95
170#define SIL_MWI_VPK_MIN 80
171#define SIL_MWI_LCRMASK_MAX 2000
172#define SIL_MWI_LCRMASK_MIN 5
173#define SIL_MWI_LCRMASK_SCALE 65536
174#define SIL_MWI_FLASH_OFF 0
175#define SIL_MWI_FLASH_ON 1
176
177/* Depricated functions now mapped directly to SiVoice versions... */
178
179#define ProSLIC_clearErrorFlag SiVoice_clearErrorFlag
180#define ProSLIC_createChannel SiVoice_createChannel
181#define ProSLIC_createControlInterface SiVoice_createControlInterface
182#define ProSLIC_createDevice SiVoice_createDevice
183#define ProSLIC_destroyChannel SiVoice_destroyChannel
184#define ProSLIC_destroyControlInterface SiVoice_destroyControlInterface
185#define ProSLIC_destroyDevice SiVoice_destroyDevice
186#define ProSLIC_getChannelEnable SiVoice_getChannelEnable
187#define ProSLIC_getErrorFlag SiVoice_getErrorFlag
188#define ProSLIC_Reset SiVoice_Reset
189#define ProSLIC_setChannelEnable SiVoice_setChannelEnable
190#define ProSLIC_setControlInterfaceCtrlObj SiVoice_setControlInterfaceCtrlObj
191#define ProSLIC_setControlInterfaceDelay SiVoice_setControlInterfaceDelay
192#define ProSLIC_setControlInterfaceGetTime SiVoice_setControlInterfaceGetTime
193#define ProSLIC_setControlInterfaceReadRAM SiVoice_setControlInterfaceReadRAM
194#define ProSLIC_setControlInterfaceReadRegister SiVoice_setControlInterfaceReadRegister
195#define ProSLIC_setControlInterfaceReset SiVoice_setControlInterfaceReset
196#define ProSLIC_setControlInterfaceSemaphore SiVoice_setControlInterfaceSemaphore
197#define ProSLIC_setControlInterfaceTimeElapsed SiVoice_setControlInterfaceTimeElapsed
198#define ProSLIC_setControlInterfaceTimerObj SiVoice_setControlInterfaceTimerObj
199#define ProSLIC_setControlInterfaceWriteRAM SiVoice_setControlInterfaceWriteRAM
200#define ProSLIC_setControlInterfaceWriteRegister SiVoice_setControlInterfaceWriteRegister
201#define ProSLIC_setSWDebugMode SiVoice_setSWDebugMode
202#define ProSLIC_SWInitChan SiVoice_SWInitChan
203#define ProSLIC_Version SiVoice_Version
204#define ProSLIC_ReadReg SiVoice_ReadReg
205#define ProSLIC_WriteReg SiVoice_WriteReg
206#define ProSLIC_ShutdownChannel ProSLIC_PowerDownConverter
207#define ProSLIC_MWISetup(PCHAN,VPK,LCR) ProSLIC_MWISetV(PCHAN,VPK)
208#define ProSLIC_MWI ProSLIC_MWISetState
209
210#define SI_MAX_INTERRUPTS 4
211
212#define PROSLIC_EXTENDED_GAIN_MAX 9
213#define PROSLIC_GAIN_MAX 6
214#define PROSLIC_GAIN_MIN -30
215/*
216** Initialization Sequence Location - Used by 18x & 17x
217*/
218typedef enum
219{
220 INIT_SEQ_BEGINNING,
221 INIT_SEQ_READ_ID,
222 INIT_SEQ_PRE_PATCH_LOAD,
223 INIT_SEQ_POST_PATCH_LOAD,
224 INIT_SEQ_PRE_CAL,
225 INIT_SEQ_POST_CAL,
226 INIT_SEQ_END
227} initSeqType;
228
229/** @mainpage
230 * This document is a supplement to the ProSLIC API User Guide. It has most
231 * of the APIs documented and hyperlinked.
232 *
233 * This document has the following tabs:
234 *
235 * - Main Page (this page) - introduction to the document.
236 * - Related pages - mainly the deprecated list is located here.
237 * Although these identifiers are present in the current release, they are
238 * targeted for deletion in a future release. Any existing customer code
239 * using deprecated identifiers should be modified as indicated.
240 * - Modules - this is the meat of the document - this has each functional group in outline format listed here.
241 * - Data Structures - This has every data structure listed in in the ProSLIC API in alphabetical order.
242 * - Files - this has the source files in hyperlink format. @note In some cases the hyperlink generator will not properly
243 * generate the correct reference or not be able to find it. In this case please use an alternative method.
244 *
245 */
246
247/** @defgroup PROSLIC_TYPES ProSLIC General Datatypes/Function Definitions
248 * This section documents functions and data structures related to the
249 * ProSLIC/FXS chipsets.
250 * @{
251 */
252
253/*
254* ----------------ProSLIC Generic DataTypes/Function Definitions----
255**********************************************************************
256*/
257
258#define MAX_PROSLIC_IRQS 32 /**< How many interrupts are supported in the ProSLIC */
259
260#ifdef ENABLE_DEBUG
261#define PROSLIC_PRINT_ERROR(CHAN, ERROR)\
262 LOGPRINT("%sError encountered on channel: %d fault code: %d\n",\
263 LOGPRINT_PREFIX, (CHAN)->channel, (ERROR))
264#else
265#define PROSLIC_PRINT_ERROR(CHAN, ERROR)
266#endif
267
268/**********************************************************************/
269/**
270* Map Proslic types to SiVoice types
271*/
272typedef SiVoiceControlInterfaceType controlInterfaceType; /**< Map ProSLIC to SiVoice type */
273typedef SiVoiceControlInterfaceType proslicControlInterfaceType; /**< Map ProSLIC to SiVoice type */
274typedef SiVoiceDeviceType ProslicDeviceType; /**< Map ProSLIC to SiVoice type */
275typedef SiVoiceChanType proslicChanType; /**< Map ProSLIC to SiVoice type */
276
277/**
278* Define channel and device type pointers
279*/
280typedef ProslicDeviceType
281*proslicDeviceType_ptr; /**< Shortcut for pointer to a ProSLIC device type */
282typedef proslicChanType
283*proslicChanType_ptr; /**< Shortcut for pointer to a ProSLIC channel type */
284
285/** @} PROSLIC_TYPES */
286
287/** @addtogroup HC_DETECT
288 * @{
289 */
290/**
291* This is structure used to store pulse dial information
292*/
293typedef struct {
294 uInt8 currentPulseDigit;
295 void *onHookTime; /**< Timestamp for when the onhook detection occured */
296 void *offHookTime; /**< Timestamp for when the offhook detection occured */
297} pulseDialType;
298
299/**
300* Defines structure for configuring pulse dial detection
301*/
302typedef struct {
303 uInt8 minOnHook; /**< Min mSec for onhook */
304 uInt8 maxOnHook; /**< Max mSec for onhook */
305 uInt8 minOffHook; /**< Min mSec for offhook */
306 uInt8 maxOffHook; /**< Max mSec for offhook */
307} pulseDial_Cfg;
308/** @} PD_DETECT */
309
310/**
311* This is structure used to store pulse dial information
312*/
313#define SI_HC_NO_ACTIVITY 0x10
314#define SI_HC_NEED_MORE_POLLS 0x20
315#define SI_HC_ONHOOK_TIMEOUT 0x41
316#define SI_HC_OFFHOOK_TIMEOUT 0x42
317#define SI_HC_HOOKFLASH 0x43
318
319#define SI_HC_NONDIGIT_DONE(X) ((X) & 0x40)
320#define SI_HC_DIGIT_DONE(X) ((X) && ((X) < 11))
321
322typedef struct
323{
324 uInt8 currentPulseDigit;
325 uInt8 last_hook_state;
326 uInt8 lookingForTimeout;
327 uInt8 last_state_reported;
328 void *hookTime; /**< Timestamp for when the onhook detection occurred */
329} hookChangeType;
330
331/**
332* Defines structure for configuring hook change detection. Times are in mSec.
333*/
334typedef struct
335{
336 uInt16 minOnHook; /**< Min mSec for onhook/break time */
337 uInt16 maxOnHook; /**< Max mSec for onhook/break time */
338 uInt16 minOffHook; /**< Min mSec for offhook/make time */
339 uInt16 maxOffHook; /**< Max mSec for offhook/make time */
340 uInt16 minInterDigit; /**< Minimum interdigit time */
341 uInt16 minHookFlash; /**< minimum hook flash time */
342 uInt16 maxHookFlash; /**< maximum hook flash time */
343 uInt16 minHook; /**< Minimum hook time, which should be >> than maxHookFlash */
344} hookChange_Cfg;
345/** @} HC_DETECT*/
346
347
348/** @addtogroup PROSLIC_INTERRUPTS
349 * @{
350 */
351/**
352* Interrupt tags
353*/
354
355/* MAINTAINER NOTE: if this enum changes, update interrupt.c in the API demo */
356typedef enum
357{
358 IRQ_OSC1_T1,
359 IRQ_OSC1_T2,
360 IRQ_OSC2_T1,
361 IRQ_OSC2_T2,
362 IRQ_RING_T1,
363 IRQ_RING_T2,
364 IRQ_PM_T1,
365 IRQ_PM_T2,
366 IRQ_FSKBUF_AVAIL, /**< FSK FIFO depth reached */
367 IRQ_VBAT,
368 IRQ_RING_TRIP, /**< Ring Trip detected */
369 IRQ_LOOP_STATUS, /**< Loop Current changed */
370 IRQ_LONG_STAT,
371 IRQ_VOC_TRACK,
372 IRQ_DTMF, /**< DTMF Detected - call @ref ProSLIC_DTMFReadDigit to decode the value */
373 IRQ_INDIRECT, /**< Indirect/RAM access completed */
374 IRQ_TXMDM,
375 IRQ_RXMDM,
376 IRQ_PQ1, /**< Power alarm 1 */
377 IRQ_PQ2, /**< Power alarm 2 */
378 IRQ_PQ3, /**< Power alarm 3 */
379 IRQ_PQ4, /**< Power alarm 4 */
380 IRQ_PQ5, /**< Power alarm 5 */
381 IRQ_PQ6, /**< Power alarm 6 */
382 IRQ_RING_FAIL,
383 IRQ_CM_BAL,
384 IRQ_USER_0,
385 IRQ_USER_1,
386 IRQ_USER_2,
387 IRQ_USER_3,
388 IRQ_USER_4,
389 IRQ_USER_5,
390 IRQ_USER_6,
391 IRQ_USER_7,
392 IRQ_DSP,
393 IRQ_MADC_FS,
394 IRQ_P_HVIC,
395 IRQ_P_THERM, /**< Thermal alarm */
396 IRQ_P_OFFLD
397} ProslicInt;
398
399/**
400* Defines structure of interrupt data - used by @ref ProSLIC_GetInterrupts
401*/
402typedef struct
403{
404 ProslicInt
405 *irqs; /**< Pointer of an array of size MAX_PROSLIC_IRQS (this is to be allocated by the caller) */
406 uInt8 number; /**< Number of IRQs detected/pending */
407} proslicIntType;
408
409
410/** @} PROSLIC_INTERRUPTS */
411
412/** @addtogroup TONE_GEN
413 * @{
414 */
415/**
416* Defines structure for configuring 1 oscillator - see your data sheet for specifics or use the configuration
417* tool to have this filled in for you.
418*/
419typedef struct
420{
421 ramData freq;
422 ramData amp;
423 ramData phas;
424 uInt8 talo;
425 uInt8 tahi;
426 uInt8 tilo;
427 uInt8 tihi;
428} Oscillator_Cfg;
429
430/**
431 * Defines structure for tone configuration.
432 */
433typedef struct
434{
435 Oscillator_Cfg osc1;
436 Oscillator_Cfg osc2;
437 uInt8 omode;
438} ProSLIC_Tone_Cfg;
439
440typedef struct
441{
442 ramData fsk[2];
443 ramData fskamp[2];
444 ramData fskfreq[2];
445 uInt8 eightBit;
446 uInt8 fskdepth;
447} ProSLIC_FSK_Cfg;
448/** @} TONE_GEN */
449
450/*****************************************************************************/
451/** @addtogroup SIGNALING
452 * @{
453 */
454/**
455* Hook states - returned by @ref ProSLIC_ReadHookStatus()
456*/
457enum
458{
459 PROSLIC_ONHOOK, /**< Hook state is onhook */
460 PROSLIC_OFFHOOK /**< Hook state is offhook */
461};
462
463#ifndef SIVOICE_CFG_NEWTYPES_ONLY
464enum
465{
466 ONHOOK = PROSLIC_ONHOOK, /**< @deprecated- Please use PROSLIC_ONHOOK and PROSLIC_OFFHOOK for future code development */
467 OFFHOOK = PROSLIC_OFFHOOK
468};
469#endif
470
471/** @} SIGNALING */
472
473/*****************************************************************************/
474/** @addtogroup PCM_CONTROL
475 * @{
476* Loopback modes
477*/
478typedef enum
479{
480 PROSLIC_LOOPBACK_NONE, /**< Loopback disabled */
481 PROSLIC_LOOPBACK_DIG, /**< Loopback is toward the PCM side */
482 PROSLIC_LOOPBACK_ANA /**< Loopback is toward the analog side */
483} ProslicLoopbackModes;
484
485/**
486* Mute options - which direction to mute
487*/
488typedef enum
489{
490 PROSLIC_MUTE_NONE = 0, /**< Don't mute */
491 PROSLIC_MUTE_RX = 0x1, /**< Mute toward the RX side */
492 PROSLIC_MUTE_TX = 0x2, /**< Mute toward the TX side */
493 PROSLIC_MUTE_ALL = 0x3 /**< Mute both directions */
494} ProslicMuteModes;
495
496/** @} PCM_CONTROL */
497
498/*****************************************************************************/
499/** @addtogroup GAIN_CONTROL
500 * @{
501* Path Selector
502*/
503enum
504{
505 TXACGAIN_SEL = 0,
506 RXACGAIN_SEL = 1
507};
508
509
510/*
511** Defines structure for configuring audio gain on the fly
512*/
513typedef struct
514{
515 ramData acgain;
516 uInt8 mute;
517 ramData aceq_c0;
518 ramData aceq_c1;
519 ramData aceq_c2;
520 ramData aceq_c3;
521} ProSLIC_audioGain_Cfg;
522
523/** @} GAIN_CONTROL */
524
525/*****************************************************************************/
526/** @addtogroup LINESTATUS
527 * @{
528 */
529/**
530* enumeration of the Proslic polarity reversal states - used by ProSLIC_PolRev API
531*/
532enum
533{
534 POLREV_STOP, /**< Stop Polarity reversal */
535 POLREV_START, /**< Start Polarity reversal */
536 WINK_START, /**< Start Wink */
537 WINK_STOP /**< Stop Wink */
538};
539
540/**
541* Defines initialization data structures
542* Linefeed states - used in @ref ProSLIC_SetLinefeedStatus and @ref ProSLIC_SetLinefeedStatusBroadcast
543*/
544enum
545{
546 LF_OPEN, /**< Open circuit */
547 LF_FWD_ACTIVE, /**< Forward active */
548 LF_FWD_OHT, /**< Forward active, onhook transmission (used for CID/VMWI) */
549 LF_TIP_OPEN, /**< Tip open */
550 LF_RINGING, /**< Ringing */
551 LF_REV_ACTIVE, /**< Reverse battery/polarity reversed, active */
552 LF_REV_OHT, /**< Reverse battery/polarity reversed, active, onhook transmission (used for CID/VMWI) */
553 LF_RING_OPEN /**< Ring open */
554} ;
555/** @} LINESTATUS */
556
557
558
559
560/*****************************************************************************/
561/** @addtogroup GEN_CFG
562 * @{
563 */
564
565/**
566* Defines initialization data structures
567*/
568typedef struct
569{
570 uInt8 address;
571 uInt8 initValue;
572} ProslicRegInit;
573
574typedef struct
575{
576 uInt16 address;
577 ramData initValue;
578} ProslicRAMInit;
579
580/**
581* ProSLIC patch object
582*/
583typedef struct
584{
585 const ramData *patchData; /**< 1024 max*/
586 const uInt16 *patchEntries; /**< 8 max */
587 const uInt32 patchSerial;
588 const uInt16 *psRamAddr; /**< 128 max */
589 const ramData *psRamData; /**< 128 max */
590} proslicPatch;
591
592/** @} GEN_CFG */
593
594
595/*****************************************************************************/
596/** @addtogroup RING_CONTROL
597 * @{
598 */
599/**
600* Ringing type options
601* Ringing type options - Trapezoidal w/ a Crest factor CF11= Crest factor 1.1 or sinusoidal.
602*/
603typedef enum
604{
605 ProSLIC_RING_TRAP_CF11,
606 ProSLIC_RING_TRAP_CF12,
607 ProSLIC_RING_TRAP_CF13,
608 ProSLIC_RING_TRAP_CF14,
609 ProSLIC_RING_TRAP_CF15,
610 ProSLIC_RING_TRAP_CF16,
611 ProSLIC_RING_SINE /***< Plain old sinusoidal ringing */
612} ProSLIC_RINGTYPE_T;
613
614/**
615* Ringing (provisioned) object
616*/
617typedef struct
618{
619 ProSLIC_RINGTYPE_T
620 ringtype; /**< Is this a sinusoid or a trapezoidal ring shape? */
621 uInt8 freq; /**< In terms of Hz */
622 uInt8 amp; /**< in terms of 1 volt units */
623 uInt8 offset; /**< In terms of 1 volt units */
624} ProSLIC_dbgRingCfg;
625
626
627/** @} RING_CONTROL */
628
629/*****************************************************************************/
630/**
631* Line Monitor - returned by @ref ProSLIC_LineMonitor
632*/
633typedef struct
634{
635 int32 vtr; /**< Voltage, tip-ring in mV */
636 int32 vtip; /**< Voltage, tip-ground in mV */
637 int32 vring; /**< Voltage, ring-ground in mV */
638 int32 vbat; /**< Voltage, battery in mV */
639 int32 vdc; /**< Voltage, Vdc in mV */
640 int32 vlong; /**< Voltage, longitudinal in mV */
641 int32 itr; /**< Loop current, in uA tip-ring */
642 int32 itip; /**< Loop current, in uA tip */
643 int32 iring; /**< Loop current, in uA ring */
644 int32 ilong; /**< Loop current, in uA longitudinal */
645 int32 p_hvic; /**< On-chip Power Calculation in mw */
646} proslicMonitorType;
647
648/*****************************************************************************/
649/** @addtogroup PROSLIC_DCFEED
650 * @{
651 */
652/**
653* Powersave
654*/
655enum
656{
657 PWRSAVE_DISABLE = 0, /**< Disable power savings mode */
658 PWRSAVE_ENABLE = 1 /**< Enable power savings mode */
659};
660
661/**
662** DC Feed Preset
663*/
664typedef struct
665{
666 ramData slope_vlim;
667 ramData slope_rfeed;
668 ramData slope_ilim;
669 ramData delta1;
670 ramData delta2;
671 ramData v_vlim;
672 ramData v_rfeed;
673 ramData v_ilim;
674 ramData const_rfeed;
675 ramData const_ilim;
676 ramData i_vlim;
677 ramData lcronhk;
678 ramData lcroffhk;
679 ramData lcrdbi;
680 ramData longhith;
681 ramData longloth;
682 ramData longdbi;
683 ramData lcrmask;
684 ramData lcrmask_polrev;
685 ramData lcrmask_state;
686 ramData lcrmask_linecap;
687 ramData vcm_oh;
688 ramData vov_bat;
689 ramData vov_gnd;
690} ProSLIC_DCfeed_Cfg;
691
692/** @} PROSLIC_DCFEED */
693
694/*****************************************************************************/
695/** @defgroup ProSLIC_API ProSLIC API
696* proslic.c function declarations
697* @{
698*/
699
700/*****************************************************************************/
701/** @defgroup DIAGNOSTICS Diagnostics
702 * The functions in this group allow one to monitor the line state for abnormal
703 * situations.
704 * @{
705 */
706
707/**
708* Test State - used in polled tests (such as PSTN Check)
709*/
710typedef struct
711{
712 int32 stage; /**< What state is the test in */
713 int32 waitIterations; /**< How many iterations to stay in a particular state */
714 int32 sampleIterations; /**< How many samples have been collected */
715} proslicTestStateType;
716
717/**
718 * @brief
719 * This function allows one to monitor the instantaneous voltage and
720 * loop current values seen on tip/ring.
721 *
722 * @param[in] pProslic - which channel should the data be collected from
723 * @param[in,out] *monitor - the data collected
724 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
725 *
726 */
727
728int ProSLIC_LineMonitor(proslicChanType_ptr pProslic,
729 proslicMonitorType *monitor);
730
731/**
732 * @brief
733 * This function reads the MADC a scaled value
734 *
735 * @param[in] pProslic - which channel should the data be collected from
736 * @param[in] addr - address to read from (MADC_ILOOP, MADC_ITIP, etc).
737 * @param[in] scale - scale to use (0 = determine based upon MADC address)
738 * @retval int32 - scaled value requested or -1 if not supported.
739 *
740 */
741
742int32 ProSLIC_ReadMADCScaled(proslicChanType_ptr pProslic, uInt16 addr,
743 int32 scale);
744
745/** @defgroup PSTN_CHECK PSTN Check
746 * Monitor for excessive longitudinal current, which
747 * would be present if a live pstn line was connected
748 * to the port. To operate these sets of functions:
749 *
750 * - Iniitalize the PSTN object by calling @ref ProSLIC_InitPSTNCheckObj
751 * - Poll at a constant rate and call @ref ProSLIC_PSTNCheck. Check the return code of this function.
752 *
753 * Alternatively, you can call the DiffPSTNCheck versions of the above two functions.
754 *
755 * @note These functions may be disabled by doing a undef of @ref PSTN_DET_ENABLE in the configuration file.
756 * @{
757*/
758#define MAX_ILONG_SAMPLES 32 /**< How many samples to collect for PSTN check */
759#define MAX_PSTN_SAMPLES 16 /**< Used in the PSTN check status code to indicate the number of samples to collect */
760
761/**
762* FEMF OPEN voltage test enable
763*/
764enum
765{
766 FEMF_MEAS_DISABLE, /**< Do not measure FEMF as part of PSTN Check */
767 FEMF_MEAS_ENABLE /**< Do measure FEMF as part of PSTN Check */
768};
769
770/** Standard line interfaces */
771typedef struct
772{
773 int32 avgThresh;
774 int32 singleThresh;
775 int32 ilong[MAX_ILONG_SAMPLES];
776 uInt8 count;
777 uInt8 samples;
778 int32 avgIlong;
779 BOOLEAN buffFull;
780} proslicPSTNCheckObjType;
781
782typedef proslicPSTNCheckObjType *proslicPSTNCheckObjType_ptr;
783
784
785/** Re-Injection line interfaces (differential) */
786typedef struct
787{
788 proslicTestStateType pState;
789 int dcfPreset1;
790 int dcfPreset2;
791 int entryDCFeedPreset;
792 uInt8 lfstate_entry;
793 uInt8 enhanceRegSave;
794 uInt8 samples;
795 int32 vdiff1[MAX_PSTN_SAMPLES];
796 int32 vdiff2[MAX_PSTN_SAMPLES];
797 int32 iloop1[MAX_PSTN_SAMPLES];
798 int32 iloop2[MAX_PSTN_SAMPLES];
799 int32 vdiff1_avg;
800 int32 vdiff2_avg;
801 int32 iloop1_avg;
802 int32 iloop2_avg;
803 int32 rl1;
804 int32 rl2;
805 int32 rl_ratio;
806 int femf_enable;
807 int32 vdiff_open;
808 int32 max_femf_vopen;
809 int return_status;
810} proslicDiffPSTNCheckObjType;
811
812typedef proslicDiffPSTNCheckObjType *proslicDiffPSTNCheckObjType_ptr;
813
814/** @}PSTN_CHECK */
815/** @}DIAGNOSTICS */
816/*****************************************************************************/
817/*
818** proslic.c function declarations
819*/
820
821/*****************************************************************************/
822/** @defgroup GEN_CFG General configuration
823 * @{
824 */
825
826/**
827 * @brief
828 * Loads patch and initializes all ProSLIC devices. Performs all calibrations except
829 * longitudinal balance.
830 *
831 * @param[in] hProslic - which channel(s) to initialize, if size > 1, then the start of the array
832 * of channels to be initialized.
833 * @param[in] size - the number of channels to initialize.
834 * @param[in] preset - general configuration preset to apply
835 *
836 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
837 * @sa ProSLIC_Init
838 */
839
840int ProSLIC_Init_MultiBOM (proslicChanType_ptr *hProslic, int size, int preset);
841
842/**
843 * @brief
844 * Loads patch and initializes all ProSLIC devices. Performs all calibrations except
845 * longitudinal balance.
846 *
847 * @param[in] hProslic - which channel(s) to initialize, if size > 1, then the start of the array
848 * of channels to be initialized.
849 * @param[in] size - the number of channels to initialize.
850 *
851 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
852 */
853
854int ProSLIC_Init (proslicChanType_ptr *hProslic, int size);
855
856/**
857 * @brief
858 * Loads patch and initializes all ProSLIC devices.
859 *
860 * @param[in] hProslic - which channel(s) to initialize, if size > 1, then the start of the array
861 * of channels to be initialized.
862 * @param[in] size - the number of channels to initialize.
863 * @param[in] option - see initOptionsType
864 *
865 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
866 */
867
868int ProSLIC_Init_with_Options (proslicChanType_ptr *hProslic, int size,
869 int option);
870
871/**
872 * @brief
873 * Performs soft reset then calls ProSLIC_Init()
874 *
875 * @param[in] hProslic - which channel(s) to re-initialize.
876 * of channels to be initialized.
877 * @param[in] size - the number of channels to initialize.
878 *
879 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
880 */
881
882int ProSLIC_Reinit (proslicChanType_ptr *hProslic, int size);
883
884/**
885 * @brief
886 * Loads registers and RAM in the ProSLICs specified.
887 *
888 * @param[in] pProslic - array of channels
889 * @param[in] pRamTable - array of RAM locations and values to write
890 * @param[in] pRegTable - array of register locations and values to write
891 * @param[in] bcast- is broadcast enabled.
892 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
893 *
894 * @note This function should NOT be used since it can bypass the standard initialization/operational state of the
895 * ProSLIC.
896 */
897
898int ProSLIC_LoadRegTable (proslicChanType *pProslic,
899 const ProslicRAMInit *pRamTable,
900 const ProslicRegInit *pRegTable,
901 int bcast);
902
903/**
904 * @brief
905 * Loads registers and RAM in the ProSLICs specified.
906 *
907 * @param[in] pProslic - array of channels
908 * @param[in] pRamTable - array of RAM locations and values to write
909 * @param[in] pRegTable - array of register locations and values to write
910 * @param[in] size - number of ProSLICS to write to.
911 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
912 *
913 * @note This function should NOT be used since it can bypass the standard initialization/operational state of the
914 * ProSLIC.
915 */
916
917int ProSLIC_LoadRegTables (proslicChanType_ptr *pProslic,
918 const ProslicRAMInit *pRamTable, const ProslicRegInit *pRegTable, int size);
919
920/**
921 * @brief
922 * Implement soft reset. For dual channel devices, you can specify a hard reset
923 * (which impacts both channels) or if the channel is actually the second
924 * channel. The default is to do a soft reset on the 1st channel.
925 *
926 * @param[in] hProslic - which channel to reset
927 * @param[in] resetOptions - PROSLIC_HARD_RESET (dual channel devices ONLY) | PROSLIC_SOFT_RESET_SECOND_CHAN (dual channel devices) | PROSLIC_BCAST_RESET | PROSLIC_SOFT_RESET
928 *
929 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
930 *
931 * @note Will abort reset if in free run mode.
932 * @note Only perform a soft reset on 1 channel at a time.
933 */
934
935#define PROSLIC_BCAST_RESET 0x8000
936#define PROSLIC_HARD_RESET 3
937#define PROSLIC_SOFT_RESET_SECOND_CHAN 2
938#define PROSLIC_SOFT_RESET 1
939
940int ProSLIC_SoftReset(proslicChanType_ptr hProslic, uInt16 resetOptions);
941
942/**
943 * @brief
944 * Configure impedance synthesis
945 *
946 * @param[in] hProslic - which channel to configure
947 * @param[in] preset - which impedance configuration to load from the constants file.
948 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
949 *
950 * @note This function can be disabled by @ref DISABLE_ZSYNTH_SETUP
951 */
952
953int ProSLIC_ZsynthSetup (proslicChanType_ptr hProslic,int preset);
954
955/**
956 * @brief
957 * This function configures the CI bits (GCI mode)
958 *
959 * @param[in] hProslic - which channel to configure
960 * @param[in] preset - which GCI preset to use from the constants file
961 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
962 *
963 * @note This function can be disabled by @ref DISABLE_CI_SETUP
964 */
965#ifndef DISABLE_CI_SETUP
966int ProSLIC_GciCISetup (proslicChanType_ptr hProslic,int preset);
967#endif
968
969/*****************************************************************************/
970/** @defgroup PROSLIC_DEBUG Debug
971 * This group of functions enables/disables debug messages as well as dump
972 * register contents.
973 * @{
974 */
975
976
977/**
978 * @brief
979 * This function allows access to SPI read RAM function pointer from interface
980 *
981 * @param[in] pProslic - pointer to channel structure
982 * @param[in] addr - address to read
983 * @retval ramData - RAM contents
984 *
985 */
986ramData ProSLIC_ReadRAM (proslicChanType *pProslic, uInt16 addr);
987
988/**
989 * @brief
990 * This function allows access to SPI write RAM function pointer from interface
991 *
992 * @param[in] pProslic - pointer to channel structure
993 * @param[in] addr - address to write
994 * @param[in] data to be written
995 * @retval int - @ref RC_NONE
996 *
997 */
998int ProSLIC_WriteRAM (proslicChanType *pProslic, uInt16 addr, ramData data);
999
1000/**
1001 * @brief
1002 * This function dumps to console the register contents of several
1003 * registers and RAM locations.
1004 *
1005 * @param[in] pProslic - which channel to dump the register contents of.
1006 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1007 *
1008 */
1009int ProSLIC_PrintDebugData (proslicChanType *pProslic);
1010
1011/**
1012 * @brief
1013 * This function dumps the registers to the console using whatever
1014 * I/O method is defined by LOGPRINT
1015 *
1016 * @param[in] pProslic - which channel to dump the register contents of.
1017 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1018 *
1019 */
1020int ProSLIC_PrintDebugReg (proslicChanType *pProslic);
1021
1022/**
1023 * @brief
1024 * This function dumps the RAM to the console using whatever
1025 * I/O method is defined by LOGPRINT
1026 *
1027 * @param[in] pProslic - which channel to dump the RAM contents of.
1028 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1029 *
1030 */
1031int ProSLIC_PrintDebugRAM (proslicChanType *pProslic);
1032
1033/** @} PROSLIC_DEBUG */
1034/*****************************************************************************/
1035/** @defgroup PROSLIC_ENABLE Enable/disable channels (for init)
1036 * @{
1037 */
1038
1039/**
1040 * @brief
1041 * This function sets the channel enable status of the FXO channel on ProSLIC devices
1042 * with integrated FXO. If NOT set, then when
1043 * the various initialization routines such as @ref SiVoice_SWInitChan is called,
1044 * then this particular channel will NOT be initialized.
1045 *
1046 * This function does not access the chipset directly, so SPI/GCI
1047 * does not need to be up during this function call.
1048 *
1049 * @param[in,out] pProslic - which channel to return the status.
1050 * @param[in] enable - The new value of the channel enable field. 0 = NOT enabled, 1 = enabled.
1051 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1052 *
1053 * @sa ProSLIC_getChannelEnable
1054 */
1055
1056int ProSLIC_SetDAAEnable(proslicChanType *pProslic, int enable);
1057
1058/** @} PROSLIC_ENABLE */
1059
1060/*****************************************************************************/
1061/** @defgroup PROSLIC_PATCH Patch management.
1062 * This group of functions write and verify the patch data needed by the
1063 * ProSLIC chipset.
1064 * @{
1065 */
1066
1067/**
1068 * @brief
1069 * Calls patch loading function for a particular channel/ProSLIC
1070 *
1071 * @param[in] hProslic - which channel/ProSLIC should be patched
1072 * @param[in] pPatch - the patch data
1073 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1074 *
1075 * @note This function should not be called directly under normal circumstances since the initialization function should
1076 * perform this operation.
1077 *
1078 * @sa ProSLIC_Init
1079 */
1080
1081int ProSLIC_LoadPatch (proslicChanType_ptr hProslic,const proslicPatch *pPatch);
1082
1083/**
1084 * @brief
1085 * Verifies patch loading function for a particular channel/ProSLIC
1086 *
1087 * @param[in] hProslic - which channel/ProSLIC should be patched
1088 * @param[in] pPatch - the patch data to verify was written to.
1089 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1090 *
1091 * @note This function should not be called directly under normal circumstances since the initialization function should
1092 * perform this operation, unless @ref DISABLE_VERIFY_PATCH is defined.
1093 *
1094 * @sa ProSLIC_Init
1095 */
1096
1097int ProSLIC_VerifyPatch (proslicChanType_ptr hProslic,const proslicPatch *pPatch);
1098
1099/** @} PROSLIC_PATCH */
1100
1101/*****************************************************************************/
1102/** @defgroup PROSLIC_GPIO GPIO Control
1103 * This group of functions configure, read and write the GPIO status pins.
1104 * @{
1105 */
1106
1107/**
1108 * @brief
1109 * This function configures the ProSLIC GPIOs by loading a gpio preset that was
1110 * set in the configuration tool.
1111 * @param[in] hProslic - which channel to configure the GPIO pins.
1112 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1113 * @sa ProSLIC_GPIOControl
1114 */
1115
1116int ProSLIC_GPIOSetup (proslicChanType_ptr hProslic);
1117
1118/**
1119 * @brief
1120 * This function controls the GPIOs of the ProSLIC.
1121 *
1122 * @param[in] hProslic - which channel to modify
1123 * @param[in,out] pGpioData - pointer to GPIO status (typically 1 byte)
1124 * @param[in] read - 1 = Read the status, 0 = write the status
1125 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1126 * @sa ProSLIC_GPIOSetup
1127 */
1128
1129int ProSLIC_GPIOControl (proslicChanType_ptr hProslic,uInt8 *pGpioData,
1130 uInt8 read);
1131
1132/** @} PROSLIC_GPIO */
1133/** @} GEN_CFG */
1134
1135/*****************************************************************************/
1136/** @defgroup PROSLIC_PULSE_METER Pulse Metering
1137 *
1138 * This group contains functions related to pulse metering.
1139 * @{
1140 */
1141
1142/**
1143* @brief
1144* This function configures the ProSLIC pulse metering by loading a pulse metering preset.
1145*
1146* @param[in] hProslic - which channel should be configured
1147* @param[in] preset - which preset to load from the defined settings made in the configuration tool.
1148* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1149*
1150* @sa ProSLIC_PulseMeterStart ProSLIC_PulseMeterStop
1151*/
1152
1153int ProSLIC_PulseMeterSetup (proslicChanType_ptr hProslic,int preset);
1154
1155/**
1156 * @brief
1157 * This function enables the pulse metering generator.
1158 *
1159 * @param[in] hProslic - which channel should play the tone.
1160 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1161 * @sa ProSLIC_PulseMeterSetup ProSLIC_PulseMeterStop ProSLIC_PulseMeterDisable
1162 *
1163 */
1164int ProSLIC_PulseMeterEnable (proslicChanType_ptr hProslic);
1165
1166/**
1167 * @brief
1168 * This function disables the pulse metering generator..
1169 *
1170 * @param[in] hProslic - which channel should play the tone.
1171 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1172 * @sa ProSLIC_PulseMeterSetup ProSLIC_PulseMeterStop ProSLIC_PulseMeterEnable
1173 *
1174 */
1175
1176int ProSLIC_PulseMeterDisable (proslicChanType_ptr hProslic);
1177
1178/**
1179 * @brief
1180 * This function starts the pulse metering tone.
1181 *
1182 * @param[in] hProslic - which channel should play the tone.
1183 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1184 * @sa ProSLIC_PulseMeterSetup ProSLIC_PulseMeterStop
1185 *
1186 */
1187
1188int ProSLIC_PulseMeterStart (proslicChanType_ptr hProslic);
1189
1190/**
1191 * @brief
1192 * This function stops the pulse metering tone.
1193 *
1194 * @param[in] hProslic - which channel should play the tone.
1195 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1196 * @sa PProSLIC_PulseMeterStart ProSLIC_PulseMeterSetup
1197 *
1198 */
1199
1200int ProSLIC_PulseMeterStop (proslicChanType_ptr hProslic);
1201
1202/** @} PROSLIC_PULSE_METER */
1203
1204/*****************************************************************************/
1205/** @defgroup PROSLIC_INTERRUPTS Interrupt control and decode
1206 * @{
1207 */
1208
1209/**
1210 * @brief
1211 * Enables interrupts configured in the general configuration data structure.
1212 *
1213 * @param[in] hProslic - which channel to enable the interrupts.
1214 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1215 *
1216 */
1217
1218int ProSLIC_EnableInterrupts (proslicChanType_ptr hProslic);
1219
1220/**
1221 * @brief
1222 * This function reads the interrupts from the ProSLIC and places them into
1223 * a @ref proslicIntType structure which contains up to @ref MAX_PROSLIC_IRQS
1224 * interrupts.
1225 *
1226 * @param[in] hProslic - which channel to enable the interrupts.
1227 * @param[in,out] pIntData - this structure contains the interrupts pending and the number of interrupts.
1228 * @retval int - number of interrupts pending or RC_CHANNEL_TYPE_ERR if wrong chip type or 0 for no interrupts.
1229 *
1230 */
1231
1232int ProSLIC_GetInterrupts (proslicChanType_ptr hProslic,
1233 proslicIntType *pIntData);
1234
1235/**
1236 * @brief
1237 * This function disables and clears interrupts on the given channel.
1238 *
1239 * @param[in] hProslic - which channel to disable
1240 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1241 */
1242
1243int ProSLIC_DisableInterrupts (proslicChanType_ptr hProslic);
1244
1245/** @} PROSLIC_INTERRUPTS */
1246
1247/*****************************************************************************/
1248/** @defgroup SIGNALING Signaling - ring & line state, and hook state
1249 * @{
1250 */
1251
1252/**
1253* Function: PROSLIC_ReadHookStatus
1254*
1255* @brief
1256* Determine hook status
1257* @param[in] hProslic - which channel to read from.
1258* @param[out] *pHookStat - will contain either @ref PROSLIC_ONHOOK or @ref PROSLIC_OFFHOOK
1259*
1260*/
1261
1262int ProSLIC_ReadHookStatus (proslicChanType_ptr hProslic,uInt8 *pHookStat);
1263
1264/*****************************************************************************/
1265/** @defgroup LINESTATUS Line Feed status
1266 * @{
1267 */
1268
1269/**
1270 * @brief
1271 * This function sets the linefeed state.
1272 *
1273 * @param[in] hProslic - which channel to modify
1274 * @param[in] newLinefeed - new line feed state - examples: LF_OPEN, LF_FWD_ACTIVE
1275 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1276 */
1277
1278int ProSLIC_SetLinefeedStatus (proslicChanType_ptr hProslic,uInt8 newLinefeed);
1279
1280/**
1281 * @brief
1282 * This function sets the linefeed state for all channels on the same daisychain.
1283 *
1284 * @param[in] hProslic - which channel to modify
1285 * @param[in] newLinefeed - new line feed state - examples: LF_OPEN, LF_FWD_ACTIVE
1286 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1287 */
1288
1289int ProSLIC_SetLinefeedStatusBroadcast (proslicChanType_ptr hProslic,
1290 uInt8 newLinefeed);
1291
1292/**
1293 * @brief
1294 * This function sets the polarity/wink state of the channel.
1295 *
1296 * @param[in] hProslic - which channel to modify
1297 * @param[in] abrupt - to change the state immediately
1298 * @param[in] newPolRevState - new polarity state - examples: POLREV_STOP, POLREV_START and WINK_START
1299 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1300 */
1301
1302int ProSLIC_PolRev (proslicChanType_ptr hProslic,uInt8 abrupt,
1303 uInt8 newPolRevState);
1304
1305/** @} LINESTATUS */
1306
1307/*****************************************************************************/
1308/** @defgroup RING_CONTROL Ring generation
1309 * @{
1310 */
1311
1312/**
1313 * @brief
1314 * Configure the ringer to the given preset (see your constants header file for exact value to use).
1315 * This includes timing, cadence, OHT mode, voltage levels, etc.
1316 *
1317 * @param[in] hProslic - which channel to configure
1318 * @param[in] preset - which of the xxxx_Ring_Cfg structures to use to configure the channel.
1319 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1320 *
1321 * @note This function can be compiled out by defining @ref DISABLE_RING_SETUP
1322 *
1323 * @sa ProSLIC_dbgSetRinging ProSLIC_RingStart ProSLIC_RingStop
1324 */
1325
1326int ProSLIC_RingSetup (proslicChanType_ptr hProslic,int preset);
1327
1328/**
1329 * @brief
1330 * Starts the ringer as confgured by @ref ProSLIC_RingSetup . If the active and inactive timers are enabled,
1331 * the ProSLIC will automatically turn on/off the ringer as programmed, else one will need to
1332 * manually implement the ring cadence. In either case, one will need to call ProSLIC_RingStop to
1333 * stop the ringer or one may call @ref ProSLIC_SetLinefeedStatus to change the state directly.
1334 *
1335 * @param[in] hProslic - which channel to enable ringing.
1336 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1337 *
1338 * @note This function can be compiled out by defining @ref DISABLE_RING_SETUP
1339 * @deprecated - Will become a macro in a future release and later removed. Customers should just call ProSLIC_SetLinefeedStatus w/ LF_RINGING.
1340 *
1341 * @sa ProSLIC_dbgSetRinging ProSLIC_RingStop ProSLIC_RingSetup
1342 */
1343
1344int ProSLIC_RingStart (proslicChanType_ptr hProslic);
1345
1346/**
1347 * @brief
1348 * Stop the ringer on the given channel and set the line state to forward active.
1349 * @deprecated - Will become a macro in a future release. Customers should just call ProSLIC_SetLinefeedStatus w/ LF_FWD_ACTIVE.
1350 *
1351 * @param[in] hProslic - which channel to modify.
1352 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1353 * @sa ProSLIC_RingSetup ProSLIC_RingStart
1354 *
1355 * @deprecated customers are encouraged to use ProSLIC_SetLinefeedStatus
1356 */
1357
1358int ProSLIC_RingStop (proslicChanType_ptr hProslic);
1359
1360/**
1361 * @brief
1362 * Provision function for setting up Ring type, frequency, amplitude and dc offset and
1363 * to store them in the given preset.
1364 *
1365 * @note: This function calculates the values, it does not set them.
1366 * @note: This code assumes ProSLIC_RingSetup() was called earlier with the highest ringer
1367 * requirements (possibly during initialization). After that, this function can
1368 * be used for meeting provisioning requirements.
1369 *
1370 * @param[in] pProslic - which channel to modify
1371 * @param[in] ringCfg - how to configure the channel's ringer
1372 * @param[in] preset - where to store the new configuration.
1373 * @sa ProSLIC_RingSetup ProSLIC_RingStart ProSLIC_RingStop
1374 */
1375
1376int ProSLIC_dbgSetRinging (proslicChanType *pProslic,
1377 ProSLIC_dbgRingCfg *ringCfg, int preset);
1378
1379/**
1380 * @brief
1381 * Enable abrupt ringing. Normally the ProSLIC would perform a smooth transistion
1382 * to start the ring signal, but in cases where a delay is not acceptable, this
1383 * function disables this feature.
1384 *
1385 * @param[in] pProslic - which channel to modify
1386 * @param[in] isEnabled - is the abrupt ringing enbaled (smooth transistion disabled).
1387 *
1388 * @note Not all chipsets support this feature.
1389 *
1390 */
1391
1392int ProSLIC_EnableFastRingStart(proslicChanType_ptr pProslic, BOOLEAN isEnabled);
1393
1394/** @} RING_CONTROL */
1395/** @} SIGNALING */
1396
1397/*****************************************************************************/
1398/** @defgroup PROSLIC_AUDIO Audio
1399 * This group of functions contains routines to configure the PCM bus, to generate tones, and to send FSK data.
1400 *
1401 * In order to start using the PCM bus, you would typically initialize the PCM bus with code similar to
1402 * the following:
1403 *
1404 * @code
1405 * if( (ProSLIC_PCMSetup(myProSLIC, MY_COMPANDING) != RC_NONE)
1406 * || (ProSLIC_PCMTimeSlotSetup(myProSLIC, pcm_ts, pcm_ts) != RC_NONE)
1407 * || (ProSLIC_PCMStart(myProSLIC) != RC_NONE))
1408 * {
1409 * return MY_PCM_INIT_ERROR;
1410 * }
1411 * @endcode
1412 *
1413 * @{
1414 * @defgroup TONE_GEN Tone generation
1415 * This group of functions is related to playing out general tones - such as dial tone, busy tone, etc. One would
1416 * typically call @ref ProSLIC_ToneGenSetup first followed by @ref ProSLIC_ToneGenStart and after some time, a call to
1417 * @ref ProSLIC_ToneGenStop to stop the tone. The direction of the tone and cadence (if any) are configured using the
1418 * GUI configuration tool's TONE dialog box and then saved in the constants file.
1419 *
1420 * @{
1421 */
1422/**
1423 * @brief
1424 * Configure the tone generator to the given preset (see your constants header file for exact value to use). It does NOT
1425 * play a particular tone out.
1426 *
1427 * @warning If @ref ProSLIC_FSKSetup was called earlier, this function will need to be called again.
1428 *
1429 * @param[in] hProslic - which channel to configure
1430 * @param[in] preset - which of the xxxx_Tone_Cfg structures to use to configure the channel.
1431 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1432 *
1433 * @note This function can be compiled out by defining @ref DISABLE_TONE_SETUP.
1434 *
1435 * @note Typically, if one is using the ProSLIC for tone generation, you will be calling this function prior to each call
1436 * into @ref ProSLIC_ToneGenStart so that the correct tone is played out.
1437 */
1438
1439int ProSLIC_ToneGenSetup (proslicChanType_ptr hProslic,int preset);
1440
1441/**
1442 * @brief
1443 * Configure the tone generator to the given preset (see your constants header file for exact value to use). It does NOT
1444 * play a particular tone out.
1445 *
1446 * @warning If @ref ProSLIC_FSKSetup was called earlier, this function will need to be called again.
1447 *
1448 * @param[in] pProslic - which channel to configure
1449 * @param[in] cfg - which of the xxxx_Tone_Cfg structures to use to configure the channel.
1450 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1451 *
1452 * @note This function can be compiled out by defining @ref DISABLE_TONE_SETUP.
1453 *
1454 * @note Typically, if one is using the ProSLIC for tone generation, you will be calling this function prior to each call
1455 * into @ref ProSLIC_ToneGenStart so that the correct tone is played out.
1456 */
1457
1458int ProSLIC_ToneGenSetupPtr(proslicChanType_ptr pProslic,
1459 ProSLIC_Tone_Cfg *cfg);
1460
1461/**
1462 * @brief
1463 * This function starts the tone configured by @ref ProSLIC_ToneGenSetup.
1464 * It is assumed that the @ref PROSLIC_AUDIO setup was performed
1465 * prior to calling this function. Also, it is suggested that
1466 * @ref ProSLIC_ToneGenSetup be called if @ref FSK_CONTROL
1467 * functions were used.
1468 *
1469 * @param[in] hProslic - which channel should play the tone.
1470 * @param[in] timerEn - are the timers to be enabled? 1 = Yes, 0 = No. When in doubt, set to 1.
1471 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1472 *
1473 * @sa ProSLIC_ToneGenSetup ProSLIC_ToneGenStop
1474 */
1475
1476int ProSLIC_ToneGenStart (proslicChanType_ptr hProslic, uInt8 timerEn);
1477
1478/**
1479 * @brief
1480 * This function turns off tone generation initiated by @ref ProSLIC_ToneGenStart.
1481 *
1482 * @param[in] hProslic - which channel should stop playing the tone.
1483 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1484 *
1485 * @sa ProSLIC_ToneGenStart ProSLIC_ToneGenSetup
1486 */
1487
1488int ProSLIC_ToneGenStop (proslicChanType_ptr hProslic);
1489
1490/** @} TONE_GEN */
1491
1492/*****************************************************************************/
1493/** @defgroup FSK_CONTROL FSK/Caller ID generation
1494 * This group of functions is related to FSK generation, typically used with Caller ID/Call Waiting
1495 * functionality. To set the frequencies, the data rate, and the FSK FIFO depth, please use the configuration
1496 * GUI FSK dialog box.
1497 *
1498 * Here's a simple example code fragment to send data via FSK:
1499 *
1500 * @note In a "real" application, you should not use ProSLIC_CheckCIDBuffer(), but instead
1501 * call ProSLIC_GetInterrupts() and check if the FSK interrrupt fired off since the
1502 * ProSLIC_GetInterrupts() will also report on loop closure/ring trip in addition FSK buffer
1503 * interrupt and the two functions will conflict with each other.
1504 *
1505 * @code
1506 *
1507 * #define FIFO_DEPTH (7-FSKBUF_DEPTH) //When we report the buffer at FSK BUFFER DEPTH, we can send
1508 * //at most 1 less than the maximum since that byte maybe still
1509 * //be modulated. Therefore, we say we can send 7 bytes, not
1510 * //8 after the interrupt.
1511 *
1512 * //ASSUME: FSK Buffer depth interrupt has been enabled in the constants file earlier...
1513 *
1514 * // This should be called every time since it is likely a tone was played
1515 * // earlier which reprograms the oscillators...
1516 * if( ProSLIC_FSKSetup(myProSLICChan, PROSLIC_NORTH_AMERICA_FSK) == RC_NONE)
1517 * {
1518 *
1519 * // Enable the CID block, at this point no tones other than the FSK ones
1520 * // should be played out...
1521 * ProSLIC_EnableCID(myProSLICChan);
1522 *
1523 * // Pre-load the FSK FIFO buffer with at most 8 bytes.
1524 * ProSLIC_SendCID(myProSLICChan,buf,MIN(bufsz,8));
1525 *
1526 * bytes_left_to_send = bufsz - MIN(bufsz,8);
1527 *
1528 * while(bytes_left_to_send > 0)
1529 * {
1530 * if(bytes_left_to_send < FIFO_DEPTH)
1531 * {
1532 * bytes_to_send = bytes_left_to_send;
1533 * }
1534 * else
1535 * {
1536 * bytes_to_send = FIFO_DEPTH;
1537 * }
1538 *
1539 * if( ProSLIC_SendCID(myProSLICChan,buf,bytes_to_send) != RC_NONE)
1540 * {
1541 * ProSLIC_DisableCID(myProSLICChan);
1542 * return MY_FSK_ERROR;
1543 * }
1544 *
1545 * bytes_left_to_send -= bytes_to_send;
1546 *
1547 * if(bytes_left_to_send)
1548 * {
1549 * do
1550 * {
1551 * // See note above about this function...
1552 * ProSLIC_CheckCIDBuffer(myProSLICChan, &is_fifo_empty);
1553 *
1554 * } while( is_fifo_empty != 1 );
1555 * }
1556 *
1557 * };
1558 *
1559 * ProSLIC_DisableCID(myProSLICChan);
1560 * @endcode
1561 *
1562 * @note The above code fragment is sub-optimal since it does constantly poll the CID buffer
1563 * state - one may want to implement the actual code using interrupts.
1564 *
1565 * @note The ProSLIC API demo does have a working example for Type 1 CID MDMF format.
1566 *
1567 * @{
1568 */
1569
1570/**
1571 * @brief
1572 * Configures the FSK generator from a configuration generated by the config tool.
1573 *
1574 * @warning If @ref ProSLIC_ToneGenSetup was called earlier, this function will need to be called again.
1575 *
1576 * @param[in] hProslic - which channel to configure
1577 * @param[in] preset - which FSK configuration to use.
1578 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1579 *
1580 * @note This function can be compiled out by defining DISABLE_FSK_SETUP
1581 */
1582
1583int ProSLIC_FSKSetup (proslicChanType_ptr hProslic,int preset);
1584
1585/**
1586 * @brief
1587 * Configures the FSK generator from a configuration generated by the config tool.
1588 *
1589 * @warning If @ref ProSLIC_ToneGenSetup was called earlier, this function will need to be called again.
1590 *
1591 * @param[in] pProslic - which channel to configure
1592 * @param[in] cfg - which FSK configuration to use.
1593 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1594 *
1595 * @note This function can be compiled out by defining DISABLE_FSK_SETUP
1596 */
1597
1598int ProSLIC_FSKSetupPtr (proslicChanType_ptr pProslic, ProSLIC_FSK_Cfg *cfg);
1599
1600/**
1601 * @brief
1602 * This function enables FSK mode and clears the FSK FIFO. It is assumed that PCM has been enabled and that @ref ProSLIC_FSKSetup
1603 * has been called at some point.
1604 *
1605 * @warning If @ref ProSLIC_ToneGenSetup was called earlier, @ref ProSLIC_FSKSetup will need to be called again.
1606 *
1607 * @param[in] hProslic - which channel to check upon.
1608 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1609 *
1610 */
1611
1612int ProSLIC_EnableCID (proslicChanType_ptr hProslic);
1613
1614/**
1615 * @brief
1616 * This function disables FSK mode.
1617 *
1618 * @param[in] hProslic - which channel to disable FSK mode.
1619 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1620 *
1621 */
1622
1623int ProSLIC_DisableCID (proslicChanType_ptr hProslic);
1624
1625/**
1626 * @brief
1627 * Check if the FSK FIFO is empty or not. This should only be called after ProSLIC_SendCID.
1628 *
1629 * @param[in] hProslic - which channel to check upon.
1630 * @param[out] fsk_buf_avail - is the buffer available? 1 = Yes, 0 = No.
1631 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1632 *
1633 * @note - This modifies the IRQ1 register contents, so some other interrupts may be lost. An alternative is to enable the
1634 * FSK FIFO interrupt and trigger off of it when it does occur in your interrupt service routine and call ProSLIC_GetInterrupts() to decode the interrupts present.
1635 */
1636
1637int ProSLIC_CheckCIDBuffer (proslicChanType_ptr hProslic, uInt8 *fsk_buf_avail);
1638
1639/**
1640 * @brief
1641 * Send numBytes as FSK encoded data. It is assumed that numBytes <= FIFO Depth (typically 8) and that the FIFO
1642 * is free. It is also assumed that @ref ProSLIC_PCMStart has been called and that we're in
1643 * @ref LF_FWD_OHT or @ref LF_REV_OHT mode for Type-1 or @ref LF_REV_ACTIVE or @ref LF_FWD_ACTIVE
1644 * if we're in Type-2 caller ID.
1645 *
1646 * @param[in] hProslic - which channel to send the data through.
1647 * @param[in] buffer - byte array of data to send.
1648 * @param[in] numBytes - number of bytes to send. MUST be less than or equal to the FIFO size
1649 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1650 *
1651 * @sa ProSLIC_CheckCIDBuffer ProSLIC_FSKSetup ProSLIC_EnableCID ProSLIC_DisableCID
1652 */
1653
1654int ProSLIC_SendCID (proslicChanType_ptr hProslic, uInt8 *buffer,
1655 uInt8 numBytes);
1656
1657/**
1658 * @brief Control if the start/stop bits are enabled.
1659 *
1660 * @param[in] hProslic - which channel to adjust
1661 * @param[in] enable_startStop - TRUE - start/stop bits are enabled, FALSE - disabled
1662 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1663 *
1664 * @note: This does not replace @ref ProSLIC_FSKSetup, but is a supplement that toggles
1665 * one of the registers that the preset modifies. It is assumed that @ref ProSLIC_FSKSetup
1666 * was called at some point earlier in the code flow.
1667 */
1668
1669int ProSLIC_ModifyCIDStartBits(proslicChanType_ptr hProslic,
1670 uInt8 enable_startStop);
1671
1672
1673/** @} FSK_CONTROL */
1674
1675/*****************************************************************************/
1676/** @defgroup AUDIO_CONTROL Audio control/configuration
1677 * @{
1678 */
1679/** @defgroup PCM_CONTROL PCM control
1680 * This group of functions is used to configure and control the PCM bus. It is essential that @ref ProSLIC_PCMSetup,
1681 * @ref ProSLIC_PCMTimeSlotSetup and @ref ProSLIC_PCMStart are called prior to any tone or FSK generation.
1682 *
1683 * See @ref PROSLIC_AUDIO code fragment on how the functions relate during initialization.
1684 *
1685 * @{
1686 */
1687
1688/**
1689 * @brief
1690 * This configures the PCM bus with parameters such as companding and data latching timing.
1691 *
1692 * @param[in] hProslic - which channel should be configured
1693 * @param[in] preset - which preset to use from the constants file (see configuration tool, PCM dialog box)
1694 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1695 *
1696 * @sa ProSLIC_PCMTimeSlotSetup ProSLIC_PCMStart
1697 */
1698
1699int ProSLIC_PCMSetup (proslicChanType_ptr hProslic,int preset);
1700
1701/**
1702 * @brief
1703 * This configures the ProSLIC to latch and send the PCM data at a particular timeslot in terms of PCM clocks (PCLK).
1704 *
1705 * Typically, for aLaw and uLaw, one can use the following calculation to set the rxcount and txcount parameters:
1706 *
1707 * rxcount = txcount = (channel_number)*8;
1708 *
1709 * For 16 bit linear, one can do the following:
1710 *
1711 * rxcount = txcount = (channel_number)*16;
1712 *
1713 * where channel_number = which ProSLIC channel on the PCM bus. For example, if one were to have 2 dual channel
1714 * ProSLIC's on the same PCM bus, this value would range from 0 to 3.
1715 *
1716 * @param[in] hProslic - which channel should be configured
1717 * @param[in] rxcount - how many clocks until reading data from the PCM bus
1718 * @param[in] txcount - how many clocks until writing data to the PCM bus.
1719 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1720 *
1721 * @sa ProSLIC_PCMSetup ProSLIC_PCMStart
1722 */
1723
1724int ProSLIC_PCMTimeSlotSetup (proslicChanType_ptr hProslic, uInt16 rxcount,
1725 uInt16 txcount);
1726
1727/**
1728 * @brief
1729 * This enables PCM transfer on the given ProSLIC channel.
1730 *
1731 * @param[in] hProslic - - which channel should be enabled
1732 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1733 *
1734 * @sa ProSLIC_PCMSetup ProSLIC_PCMTimeSlotSetup ProSLIC_PCMStop
1735 */
1736
1737int ProSLIC_PCMStart (proslicChanType_ptr hProslic);
1738
1739/**
1740 * @brief
1741 * This disables PCM transfer on the given ProSLIC channel. Typically, this is called for debugging
1742 * purposes only.
1743 *
1744 * @param[in] hProslic - - which channel should be disabled
1745 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1746 *
1747 * @sa ProSLIC_PCMSetup ProSLIC_PCMTimeSlotSetup ProSLIC_PCMStart
1748 */
1749
1750int ProSLIC_PCMStop (proslicChanType_ptr hProslic);
1751
1752/**
1753 * @brief
1754 * Program desired loopback test mode for the given channel.
1755 *
1756 * @param[in] hProslic - which channel should be modified
1757 * @param[in] newMode - what is the desired loopback mode.
1758 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1759 *
1760 */
1761
1762int ProSLIC_SetLoopbackMode (proslicChanType_ptr hProslic,
1763 ProslicLoopbackModes newMode);
1764
1765/**
1766 * @brief
1767 * Program desired mute test mode for the given channel.
1768 *
1769 * @param[in] hProslic - which channel should be modified
1770 * @param[in] muteEn - what is the desired mode.
1771 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1772 *
1773 */
1774
1775int ProSLIC_SetMuteStatus (proslicChanType_ptr hProslic,
1776 ProslicMuteModes muteEn);
1777
1778/** @} PCM_CONTROL */
1779
1780/*****************************************************************************/
1781/** @defgroup GAIN_CONTROL Gain control
1782 * @{
1783 */
1784
1785/**
1786 * @brief
1787 * Sets the TX audio gain (toward the network). This funcion DOES NOT actually calculate the values for the preset.
1788 * To dynamically calculate the values, you would need to call @ref ProSLIC_dbgSetTXGain .
1789 *
1790 * @param[in] hProslic - which channel to configure
1791 * @param[in] preset - which preset to use (this may be from the constants file)
1792 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1793 *
1794 * @note One can use this in conjunction with @ref ProSLIC_dbgSetTXGain to dynamically
1795 * change the audio gain. It is important to have the presets of both routines match.
1796 *
1797 * The following code * fragment will set the TX audio gain to -5 dB:
1798 *
1799 * @code
1800 * ProSLIC_dbgSetTXGain(myChannel, -5, MY_IMPEDENCE,0);
1801 * ProSLIC_TXAudioGainSetup(myChannel,0);
1802 * @endcode
1803 *
1804 * @sa ProSLIC_RXAudioGainSetup ProSLIC_dbgSetTXGain ProSLIC_AudioGainSetup
1805 */
1806
1807int ProSLIC_TXAudioGainSetup (proslicChanType_ptr hProslic,int preset);
1808
1809/**
1810 * @brief
1811 * Adjusts gain of TX audio path by scaling the PGA and Equalizer coefficients by the supplied values.
1812 *
1813 * @param[in] hProslic - which channel to configure
1814 * @param[in] preset - which preset to use (this may be from the constants file)
1815 * @param[in] pga_scale - scale factor which pga coefficients are to be multiplied
1816 * @param[in] eq_scale - scale factor which equalizer coefficients are to be multiplied
1817 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1818 *
1819 * @note This function can be used in lieu of @ref ProSLIC_dbgSetTXGain to dynamically
1820 * change the audio gain when gain steps of 0.1dB do not suffice, or if an attenuation
1821 * > 30dB is required.
1822 *
1823 * The following code * fragment will scale the TX audio gain by a factor of (0.707)*(0.500)
1824 *
1825 * @code
1826 * uInt32 pga_gain_scale = 707;
1827 * uInt32 eq_gain_scale = 500;
1828 * ProSLIC_TXAudioGainScale(pProslic,DEFAULT_PRESET,pga_gain_scale,eq_gain_scale);
1829 * @endcode
1830 *
1831 * @sa ProSLIC_RXAudioGainScale
1832 */
1833int ProSLIC_TXAudioGainScale (proslicChanType_ptr hProslic,int preset,
1834 uInt32 pga_scale,uInt32 eq_scale);
1835
1836/**
1837 * @brief
1838 * Configures the RX audio gain (toward the telephone). This function DOES NOT actually calculate the values for the preset.
1839 * To dynamically calculate the values, you would need to call @ref ProSLIC_dbgSetRXGain .
1840 *
1841 * @param[in] hProslic - which channel to configure
1842 * @param[in] preset - which preset to use (this may be from the constants file)
1843 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1844 *
1845 * @note One can use this in conjunction with @ref ProSLIC_dbgSetRXGain to dynamically
1846 * change the audio gain. It is important to have the presets of both routines match.
1847 *
1848 * The following code * fragment will set the RX audio gain to -1 dB:
1849 *
1850 * @code
1851 * ProSLIC_dbgSetRXGain(myChannel, -1, MY_IMPEDENCE,0);
1852 * ProSLIC_RXAudioGainSetup(myChannel,0);
1853 * @endcode
1854 *
1855 * @sa ProSLIC_TXAudioGainSetup ProSLIC_dbgSetRXGain ProSLIC_AudioGainSetup
1856 */
1857
1858int ProSLIC_RXAudioGainSetup (proslicChanType_ptr hProslic,int preset);
1859
1860/**
1861 * @brief
1862 * Adjusts gain of RX audio path by scaling the PGA and Equalizer coefficients by the supplied values.
1863 *
1864 * @param[in] hProslic - which channel to configure
1865 * @param[in] preset - which preset to use (this may be from the constants file)
1866 * @param[in] pga_scale - scale factor which pga coefficients are to be multiplied
1867 * @param[in] eq_scale - scale factor which equalizer coefficients are to be multiplied
1868 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1869 *
1870 * @note This function can be used in lieu of @ref ProSLIC_dbgSetRXGain to dynamically
1871 * change the audio gain when gain steps of 0.1dB do not suffice, or if an attenuation
1872 * > 30dB is required.
1873 *
1874 * The following code * fragment will scale the TX audio gain by a factor of (0.707)*(0.500)
1875 *
1876 * @code
1877 * uInt32 pga_gain_scale = 707;
1878 * uInt32 eq_gain_scale = 500;
1879 * ProSLIC_RXAudioGainScale(pProslic,DEFAULT_PRESET,pga_gain_scale,eq_gain_scale);
1880 * @endcode
1881 *
1882 * @sa ProSLIC_TXAudioGainScale
1883 */
1884int ProSLIC_RXAudioGainScale (proslicChanType_ptr hProslic,int preset,
1885 uInt32 pga_scale,uInt32 eq_scale);
1886
1887/**
1888 * @brief
1889 * Configures and sets the audio gains - for both RX (toward the phone) and the TX (toward the network). Unlike
1890 * the @ref ProSLIC_RXAudioGainSetup and @ref ProSLIC_TXAudioGainSetup this does both the calculations and then
1891 * configures the given channel in one step. It is assumed that the preset gain array is at least 2 elements in size.
1892 *
1893 * @param[in] hProslic - which channel to configure
1894 * @param[in] rxgain - what is the gain/loss of the RX transmit path in 1 dB units (negative = attenuation)
1895 * @param[in] txgain - what is the gain/loss of the TX transmit path in 1 dB units (negative = attenuation)
1896 * @param[in] preset - what is the impedance preset value
1897 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1898 *
1899 * The following code * fragment will set the RX audio gain to -1 dB snd TX audio gain to -5 dB:
1900 *
1901 * @code
1902 * ProSLIC_AudioGain(myChannel, -1, -5, MY_IMPEDENCE);
1903 * @endcode
1904 *
1905 * @sa ProSLIC_TXAudioGainSetup ProSLIC_dbgSetRXGain ProSLIC_dbgSetRXGain ProSLIC_dbgSetTXGain
1906 */
1907
1908int ProSLIC_AudioGainSetup (proslicChanType_ptr hProslic,int32 rxgain,
1909 int32 txgain,int preset);
1910
1911/**
1912 * @brief
1913 * This function calculates the preset values for the RX audio (toward the telephone) - it does NOT set the
1914 * actual register values. For that, please use @ref ProSLIC_RXAudioGainSetup .
1915 *
1916 * @param[in] pProslic - which channel to configure
1917 * @param[in] gain - gain to set the preset values to.
1918 * @param[in] impedance_preset - impedence preset in the constants file.
1919 * @param[in] audio_gain_preset - index to the audio gain preset to store the value.
1920 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1921 *
1922 * @sa ProSLIC_RXAudioGainSetup ProSLIC_AudioGainSetup ProSLIC_dbgSetTXGain
1923 */
1924
1925int ProSLIC_dbgSetRXGain (proslicChanType *pProslic, int32 gain,
1926 int impedance_preset, int audio_gain_preset);
1927
1928/**
1929 * @brief
1930 * This function calculates the preset values for the TX audio (toward the network) - it does NOT set the
1931 * actual register values. For that, please use @ref ProSLIC_TXAudioGainSetup .
1932 *
1933 * @param[in] pProslic - which channel to configure
1934 * @param[in] gain - gain to set the preset values to.
1935 * @param[in] impedance_preset - impedance preset in the constants file.
1936 * @param[in] audio_gain_preset - index to the audio gain preset to store the value.
1937 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1938 *
1939 * @sa ProSLIC_TXAudioGainSetup ProSLIC_AudioGainSetup ProSLIC_dbgSetRXGain
1940 */
1941
1942int ProSLIC_dbgSetTXGain (proslicChanType *pProslic, int32 gain,
1943 int impedance_preset, int audio_gain_preset);
1944
1945/** @} GAIN_CONTROL */
1946/** @} AUDIO_CONTROL */
1947/** @} PROSLIC_AUDIO */
1948
1949/*****************************************************************************/
1950/** @defgroup HC_DETECT Hook Change detection
1951 *
1952 * This function group has routines used to implement a pulse dial, hook flash
1953 * and general hook change detection. The outline of how to use these
1954 * functions is as follows:
1955 *
1956 * - Initialize the data structure w/ @ref ProSLIC_InitializeHookChangeDetect
1957 * - When hook change is detected or if there has been no activity for a minimum
1958 * of the interdigit time, call @ref ProSLIC_HookChangeDetect. Keep on calling
1959 * the function until we have a return code not equal to SI_HC_NEED_MORE_POLLS.
1960 * Again, the function should be called, when no hook activity is detected at
1961 * minimum of the interdigit time.
1962 *
1963 * General theory (pulse digit):
1964 *
1965 * ---|___|-----|__|---------
1966 *
1967 * A B C B D
1968 *
1969 * A - Offhook (time unknown)
1970 * B - Onhook (break time)
1971 * C - Offhook (make time)
1972 * D - Interdigit delay
1973 *
1974 * We report after D occurs a pulse digit as long as the duration for B
1975 * is met.
1976 *
1977 * For hook flash, we are looking at
1978 *
1979 * ----|________________|-----------
1980 *
1981 *
1982 * Here we're looking for the pulse width meets a certain min/max time. If the
1983 * time is exceeded, then we have likely a onhook or offhook event.
1984 *
1985 * @note This set of functions require that the elapsed timer functions
1986 * documented in @ref PROSLIC_CUSTOMER_TIMER are implemented.
1987 *
1988 * @{
1989 */
1990
1991/**
1992 * @brief
1993 * Initialize pulse dial/hook detection parameters.
1994 *
1995 * @param[in,out] pPulse - the structure that is to be initialized. Refer to your target market's pulse dial standard for exact values.
1996 * @param[in] hookTime - a timer object suitable to be passed to a function of type @ref system_timeElapsed_fptr
1997 *
1998 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
1999 */
2000
2001int ProSLIC_InitializeHookChangeDetect(hookChangeType *pPulse,void *hookTime);
2002
2003/**
2004 * @brief
2005 * Implements pulse dial detection and should be called at every hook transition and after the minimum interdigit delay time (should continue calling until
2006 * the function returns back with a value other than SI_HC_NEED_MORE_POLLS.
2007 *
2008 * @param[in] pProslic - which channel had a hook transition.
2009 * @param[in] pPulsedialCfg - what is the criteria to determine on/off hook states.
2010 * @param[in,out] pPulseDialData - contians the timer information that was set in
2011 * @ref ProSLIC_InitializeHookChangeDetect as well as the pulse digit detected
2012 *
2013 * @retval int - either SI_HC_xxx values or a value between 1-10 for the number of pulses detected. In most cases, a 0 is 10 pulses. Please refer to
2014 * your country's pulse dial standard for exact encoding.
2015 */
2016
2017uInt8 ProSLIC_HookChangeDetect (proslicChanType *pProslic,
2018 hookChange_Cfg *pPulsedialCfg, hookChangeType *pPulseDialData);
2019
2020/** @} HC_DETECT */
2021
2022/*****************************************************************************/
2023/** @addtogroup PROSLIC_AUDIO
2024 * @{
2025 * @defgroup PROSLIC_DTMF_DECODE DTMF Decode
2026 * This section covers DTMF decoding.
2027 *
2028 * @note Not all chipsets support this capability. Please review your chipset
2029 * documentation to confirm this capability is supported.
2030 * @{
2031 */
2032
2033/**
2034 * @brief
2035 * Read/Decode DTMF digits. The "raw" hexcode is returned in this function and would require
2036 * further processing. For example, on the Si3217x chipset, the following mapping exists:
2037 *
2038 * DTMF Digit | API output value
2039 * :-|:---
2040 * 0 | 0xA
2041 * 1 | 1
2042 * 2 | 2
2043 * 3 | 3
2044 * 4 | 4
2045 * 5 | 5
2046 * 6 | 6
2047 * 7 | 7
2048 * 8 | 8
2049 * 9 | 9
2050 * A | 0xD
2051 * B | 0xE
2052 * C | 0xF
2053 * D | 0
2054 * \*| 0xB
2055 * \# |0xC
2056 *
2057 * @note This function is only valid after @ref IRQ_DTMF occurred and should be called shortly
2058 * thereafter.
2059 *
2060 * @warning Not all ProSLIC chipsets have a DTMF decoder. Please review your chipset to make
2061 * sure this capability exists.
2062 *
2063 * @param[in] hProslic - which channel is to be decoded.
2064 * @param[out] pDigit - "raw" DTMF value (see comments in description)
2065 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2066 *
2067 *
2068 */
2069
2070int ProSLIC_DTMFReadDigit (proslicChanType_ptr hProslic,uInt8 *pDigit);
2071
2072/** @} PROSLIC_DTMF_DECODE */
2073/** @} PROSLIC_AUDIO */
2074
2075/*****************************************************************************/
2076/** @defgroup PROSLIC_POWER_CONVERTER Power Converter control
2077 * @{
2078 */
2079/**
2080* @brief
2081* Powers all DC/DC converters sequentially with delay to minimize peak power draw on VDC.
2082* @param[in] hProslic - which channel to change state.
2083* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2084*
2085* @sa ProSLIC_PowerDownConverter
2086*
2087*/
2088
2089int ProSLIC_PowerUpConverter(proslicChanType_ptr hProslic);
2090
2091/**
2092* @brief
2093* Safely power down dcdc converter after ensuring linefeed
2094* is in the open state. Test power down by setting error
2095* flag if detected voltage does no fall below 5v.
2096*
2097* @param[in] hProslic - which channel to change state.
2098* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2099*
2100* @sa ProSLIC_PowerUpConverter
2101*
2102*/
2103
2104int ProSLIC_PowerDownConverter(proslicChanType_ptr hProslic);
2105
2106/**
2107* @brief
2108* Set channel flag to indicate that the polarity of the
2109* DC-DC converter drive signal is to be inverted from what
2110* is indicated in the General Parameters. This inversion is
2111* relative to the polarity established by the General Parameters,
2112* not an absolute polarity.
2113*
2114*
2115* @param[in] hProslic - which channel to change state.
2116* @param[in] flag - inversion flag (1 - inverted, 0 - no inversion)
2117* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2118*
2119* @sa ProSLIC_PowerUpConverter
2120*
2121*/
2122int ProSLIC_SetDCDCInversionFlag(proslicChanType_ptr hProslic, uInt8 flag);
2123
2124
2125/** @} PROSLIC_POWER_CONVERTER */
2126/*****************************************************************************/
2127/** @defgroup PROSLIC_LB_CALIBRATION LB Calibration
2128 * @{
2129 */
2130
2131/**
2132 * @brief
2133 * Run canned longitudinal balance calibration.
2134 *
2135 * @param[in] pProslic - start channel to start from for calibration.
2136 * @param[in] size - number of channels to calibrate
2137 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2138 *
2139 * @note
2140 * Use the @ref ProSLIC_Init function to perform all calibrations except Longitudinal Balance (LB).
2141 * Use the @ref ProSLIC_LBCal function to perform LB calibration. LB Calibration typically needs
2142 * to execute LB calibration once per system setup without a load connected. The LB calibration
2143 * results can be stored in non-volatile storage (flash, eeprom) and retrieved during your normal
2144 * ProSLIC initialization.
2145 *
2146* @sa ProSLIC_GetLBCalResult ProSLIC_LoadPreviousLBCal ProSLIC_LoadPreviousLBCalPacked ProSLIC_GetLBCalResultPacked
2147 */
2148
2149int ProSLIC_LBCal (proslicChanType_ptr *pProslic, int size);
2150
2151/**
2152 * @brief
2153 * This function returns the coefficient results of the last LB calibration.
2154 *
2155 * @param[in] pProslic - which channel to retrieve the values from.
2156 * @param[out] result1 - results read from the last calibration
2157 * @param[out] result2 - results read from the last calibration
2158 * @param[out] result3 - results read from the last calibration
2159 * @param[out] result4 - results read from the last calibration
2160* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2161*
2162* @sa ProSLIC_LBCal ProSLIC_LoadPreviousLBCal ProSLIC_LoadPreviousLBCalPacked ProSLIC_LBCal ProSLIC_GetLBCalResultPacked
2163*/
2164
2165int ProSLIC_GetLBCalResult (proslicChanType *pProslic,int32 *result1,
2166 int32 *result2,int32 *result3,int32 *result4);
2167
2168/**
2169 * @brief
2170 * This function loads previously stored LB calibration results to the appropriate ProSLIC
2171 * RAM locations.
2172 *
2173 * @param[in] pProslic - which channel to program the values
2174 * @param[in] result1 - values to be written
2175 * @param[in] result2 - values to be written
2176 * @param[in] result3 - values to be written
2177 * @param[in] result4 - values to be written
2178* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2179*
2180* @sa ProSLIC_LBCal ProSLIC_LoadPreviousLBCalPacked ProSLIC_LBCal ProSLIC_GetLBCalResult ProSLIC_GetLBCalResultPacked
2181*/
2182
2183int ProSLIC_LoadPreviousLBCal (proslicChanType *pProslic,int32 result1,
2184 int32 result2,int32 result3,int32 result4);
2185
2186/**
2187 * @brief
2188 * This function returns the results of the last LB calibration packed into single int32.
2189 *
2190 * @param[in] pProslic - which channel to retrieve the values from.
2191 * @param[out] result - results - where to store the value
2192* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2193*
2194* @sa ProSLIC_LBCal ProSLIC_LoadPreviousLBCal ProSLIC_LoadPreviousLBCalPacked ProSLIC_LBCal
2195*/
2196
2197int ProSLIC_GetLBCalResultPacked (proslicChanType *pProslic,int32 *result);
2198
2199/**
2200 * @brief
2201 * This function loads previously stored LB calibration results that are in the packed format.
2202 *
2203 * @param[in] pProslic - which channel to retrieve the values from.
2204 * @param[in] result - results read from @ref ProSLIC_GetLBCalResultPacked
2205* @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2206*
2207* @sa ProSLIC_LBCal ProSLIC_LoadPreviousLBCal ProSLIC_LBCal ProSLIC_GetLBCalResultPacked
2208*
2209*/
2210
2211int ProSLIC_LoadPreviousLBCalPacked (proslicChanType *pProslic,int32 *result);
2212
2213/** @} PROSLIC_LB_CALIBRATION */
2214
2215
2216/*****************************************************************************/
2217/** @addtogroup DIAGNOSTICS
2218 * @{
2219 */
2220
2221/**
2222 * @brief
2223 * This function can be used to verify that the SPI interface is functioning
2224 * properly by performing a series of read back tests. This test DOES modify
2225 * certain registers, so a reinitialization will be required. This test is
2226 * recommended only for development use.
2227 *
2228 * @param[in] pProslic - This should point to the channel that is to be verified.
2229 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error amd will typically return back
2230 * @ref RC_SPI_FAIL if a SPI failure occured.
2231 */
2232
2233int ProSLIC_VerifyControlInterface (proslicChanType_ptr pProslic);
2234
2235/** @addtogroup PSTN_CHECK PSTN Check
2236 * @{
2237 */
2238
2239/**
2240 * @brief
2241 * Allocates memory for a PSTN check object. One channel object is needed per
2242 * ProSLIC channel.
2243 *
2244 * @param[in,out] pstnCheckObj - pointer to the object that is to be initialized.
2245 * @param[in] num_objs - number of objects to allocate
2246 *
2247 * @retval 0 = OK
2248 */
2249
2250int ProSLIC_CreatePSTNCheckObjs(proslicPSTNCheckObjType_ptr *pstnCheckObj,
2251 unsigned int num_objs);
2252#define ProSLIC_CreatePSTNCheckObj(PTRPTR) ProSLIC_CreatePSTNCheckObjs((PTRPTR), 1)
2253
2254/**
2255 * @brief
2256 * Allocates memory for a differential PSTN check object. One channel object is needed per
2257 * ProSLIC channel.
2258 *
2259 * @param[in,out] pstnCheckObj - pointer to the object that is to be initialized.
2260 * @param[in] num_objs - number of objects to allocate
2261 *
2262 * @retval 0 = OK
2263 */
2264
2265int ProSLIC_CreateDiffPSTNCheckObjs(proslicDiffPSTNCheckObjType_ptr
2266 *pstnCheckObj, unsigned int num_objs);
2267#define ProSLIC_CreateDiffPSTNCheckObj(PTRPTR) ProSLIC_CreateDiffPSTNCheckObjs((PTRPTR), 1)
2268
2269/**
2270 * @brief
2271 * Destroys a PSTN check object and deallocates memory.
2272 *
2273 * @param[in] pstnCheckObj - object to deallocate.
2274 *
2275 * @retval 0 = OK
2276 */
2277
2278#define ProSLIC_DestroyPSTNCheckObj ProSLIC_DestroyPSTNCheckObjs
2279int ProSLIC_DestroyPSTNCheckObjs(proslicPSTNCheckObjType_ptr *pstnCheckObj);
2280
2281/**
2282 * @brief
2283 * Destroys a differential PSTN check object and deallocates memory.
2284 *
2285 * @param[in] pstnCheckObj - object to deallocate.
2286 *
2287 * @retval 0 = OK
2288 */
2289
2290#define ProSLIC_DestroyDiffPSTNCheckObj ProSLIC_DestroyDiffPSTNCheckObjs
2291int ProSLIC_DestroyDiffPSTNCheckObjs(proslicDiffPSTNCheckObjType_ptr
2292 *pstnCheckObj);
2293
2294/**
2295 * @brief
2296 * Initialize pstnCheckObj structure members
2297 *
2298 * @param[in] pstnCheckObj - which object to initialize
2299 * @param[in] avgThresh - Average current threshold that indicates a PSTN is present (uA).
2300 * @param[in] singleThresh - Single current threshold that indicates a PSTN is present (uA).
2301 * @param[in] samples - number of samples to collect
2302 * @retval 0 = OK
2303 */
2304
2305int ProSLIC_InitPSTNCheckObj(proslicPSTNCheckObjType_ptr pstnCheckObj,
2306 int32 avgThresh, int32 singleThresh, uInt8 samples);
2307
2308/**
2309 * @brief
2310 * This function initializes a differential PSTN detection object.
2311 *
2312 * @param[in,out] pstnDiffCheckObj - object to be initialized
2313 * @param[in] preset1 - DC Feed preset to be used for first loop I/V measurement
2314 * @param[in] preset2 - DC Feed preset to be used for second loop I/V measurement
2315 * @param[in] entry_preset - restore_preset DC Feed preset that is restored after PSTN check is complete.
2316 * @param[in] femf_enable - Flag to enable OPEN state hazardous voltage measurement (0 = disabled, 1 = enabled)
2317 * @retval 0 = OK
2318 */
2319
2320int ProSLIC_InitDiffPSTNCheckObj(proslicDiffPSTNCheckObjType_ptr
2321 pstnDiffCheckObj, int preset1, int preset2, int entry_preset, int femf_enable);
2322
2323/**
2324 * @brief
2325 * This function monitors longitudinal current (average and single sample) to quickly identify
2326 * the presence of a live PSTN line. Sufficient polling needs to occur in order to quickly determine
2327 * if a PSTN line is preset or not.
2328 *
2329 * @param[in] pProslic - which channel to run this test on.
2330 * @param[in] pPSTNCheck - the initialized data structure that contains the intermediate results of this test.
2331 * @retval 0 = no PSTN detected/thresholds have not been exceeded, 1 = PSTN detected, state machine reset.
2332 *
2333 * @note
2334 * If wanting to restart the test, one will need to call @ref ProSLIC_InitPSTNCheckObj again. However, if the
2335 * number of samples exceeds the buffer then the function will "wrap".
2336 */
2337
2338int ProSLIC_PSTNCheck(proslicChanType *pProslic,
2339 proslicPSTNCheckObjType *pPSTNCheck);
2340
2341/**
2342 * @brief
2343 * This function monitors for a foreign voltage (if enabled) and measures the differential I/V
2344 * characteristics of the loop at 2 unique settings to detect a foreign PSTN. It is assumed that polling will
2345 * occur at the configured value found in @ref PSTN_DET_POLL_RATE.
2346 *
2347 * @param[in] pProslic - channel to be monitored
2348 * @param[in,out] pPSTNCheck - pointer to an initialized structure that is used by the function to
2349 * store state information.
2350 * @retval int @ref RC_NONE - test is in progress, @ref RC_COMPLETE_NO_ERR - test complete, no errors, @ref RC_PSTN_OPEN_FEMF - detected foreign voltage, RC_CHANNEL_TYPE_ERR = a non-ProSLIC device was called to perform this function
2351 */
2352int ProSLIC_DiffPSTNCheck(proslicChanType *pProslic,
2353 proslicDiffPSTNCheckObjType *pPSTNCheck);
2354
2355/** @} PSTN_CHECK */
2356/** @} DIAGNOSTICS*/
2357
2358/*****************************************************************************/
2359/** @defgroup PROSLIC_DCFEED DC Feed Setup and control
2360 * @{
2361 */
2362
2363/**
2364 * @brief
2365 * Configures the DC feed from a preset.
2366 *
2367 * @param[in] hProslic - which channel to configure
2368 * @param[in] preset - the preset to use
2369 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2370 *
2371 * @note This function can be disabled by @ref DISABLE_DCFEED_SETUP
2372 */
2373
2374int ProSLIC_DCFeedSetup (proslicChanType_ptr hProslic,int preset);
2375
2376/**
2377 * @brief
2378 * Configures the DC feed from a preset.
2379 *
2380 * @param[in] hProslic - which channel to configure
2381 * @param[in] cfg - pointer to preset storage structure
2382 * @param[in] preset - the preset to use
2383 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2384 *
2385 * @note This function can be disabled by @ref DISABLE_DCFEED_SETUP
2386 */
2387int ProSLIC_DCFeedSetupCfg (proslicChanType_ptr hProslic,
2388 ProSLIC_DCfeed_Cfg *cfg, int preset);
2389
2390/**
2391 * @brief
2392 * This function allows one to adjust the DC open circuit voltage level dynamically. Boundary checking is done.
2393 *
2394 * @note This function does NOT modify the register sets needed, it calculates the correct values and stores
2395 * them in the correct preset. Use @ref ProSLIC_DCFeedSetup to program the device with the new values.
2396 *
2397 * @param[in] pProslic - which channel to configure
2398 * @param[in] v_vlim_val - absolute voltage level
2399 * @param[in] preset - DC Feed preset to be modified.
2400 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2401 *
2402 * @sa ProSLIC_dbgSetDCFeedIloop ProSLIC_DCFeedSetup
2403 */
2404
2405int ProSLIC_dbgSetDCFeedVopen (proslicChanType *pProslic, uInt32 v_vlim_val,
2406 int32 preset);
2407
2408/**
2409 * @brief
2410 * This function allows one to adjust the loop current level dynamically. Boundary checking is done.
2411 *
2412 * @note This function does NOT modify the register sets needed, it calculates the correct values and stores
2413 * them in the correct preset. Use @ref ProSLIC_DCFeedSetup to program the device with the new values.
2414 *
2415 * @param[in] pProslic - which channel to configure
2416 * @param[in] i_ilim_val - loop current level
2417 * @param[in] preset - DC Feed preset to be modified.
2418 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2419 *
2420 * @sa ProSLIC_dbgSetDCFeedVopen ProSLIC_DCFeedSetup
2421 */
2422
2423int ProSLIC_dbgSetDCFeedIloop (proslicChanType *pProslic, uInt32 i_ilim_val,
2424 int32 preset);
2425
2426/**
2427 * @brief
2428 * This function allows one to enable/disable power savings mode found on some of the chipsets. This allows one
2429 * to change the default value set in the GUI config tool.
2430 *
2431 * @param[in] pProslic - which channel to configure
2432 * @param[in] pwrsave - power savings mode enabled or disabled - value expected: @ref PWRSAVE_DISABLE or @ref PWRSAVE_ENABLE
2433 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2434 *
2435 */
2436
2437int ProSLIC_SetPowersaveMode(proslicChanType *pProslic, int pwrsave);
2438
2439/** @} PROSLIC_DCFEED */
2440
2441/*****************************************************************************/
2442/** @defgroup MESSAGE_WAITING Message Waiting Indicator routines
2443 * @{
2444 */
2445
2446/**
2447 * @brief
2448 * Configure optional MWI voltage settings. Default value is 95v.
2449 *
2450 * @details
2451 * Set MWI flashing voltage level (Vpk).
2452 *
2453 * @note
2454 * Proper patch must be loaded for this feature to work properly. Code does not
2455 * automatically verify that this patch is loaded.
2456 *
2457 * @param[in] hProslic - channel to modify
2458 * @param[in] vpk_mag - MWI voltage level (vpk) (no change is made if 0)
2459 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2460 */
2461int ProSLIC_MWISetV (proslicChanType_ptr hProslic,uInt16 vpk_mag);
2462
2463/**
2464 * @brief
2465 * Enables message waiting indicator feature
2466 *
2467 * @details
2468 * Message waiting (neon flashing) enabled if device is in the onhook state.
2469 * Otherwise, function will not execute and return RC_MWI_ENABLE_FAIL. This
2470 * function must be called to ENABLE MWI prior to calling ProSLIC_MWI to toggle
2471 * the voltage level on TIP-RING.
2472 *
2473 * @note
2474 * Proper patch must be loaded for this feature to work properly. Code does not
2475 * automatically verify that this patch is loaded.
2476 *
2477 * @param[in] hProslic - channel to modify
2478 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2479 */
2480int ProSLIC_MWIEnable (proslicChanType_ptr hProslic);
2481
2482/**
2483 * @brief
2484 * Disables message waiting indicator feature
2485 *
2486 * @details
2487 * Message waiting (neon flashing) disable. Turns off flashing and disabled
2488 * MWI feature.
2489 *
2490 * @note
2491 * Proper patch must be loaded for this feature to work properly. Code does not
2492 * automatically verify that this patch is loaded.
2493 *
2494 * @param[in] hProslic - channel to modify
2495 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2496 */
2497int ProSLIC_MWIDisable (proslicChanType_ptr hProslic);
2498
2499/**
2500 * @brief
2501 * Implements message waiting indicator
2502 *
2503 * @details
2504 * Message waiting (neon flashing) state toggling. If MWI feature has not been
2505 * enabled by calling ProSLIC_SetMWIEnable(), then this function will return
2506 * RC_MWI_NOT_ENABLED
2507 *
2508 * @note
2509 * Proper patch must be loaded for this feature to work properly. Code does not
2510 * automatically verify that this patch is loaded.
2511 *
2512 * @param[in] hProslic - channel to modify
2513 * @param[in] flash_on - 0 = lamp off, 1 = lamp on.
2514 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2515 */
2516
2517int ProSLIC_SetMWIState(proslicChanType_ptr hProslic,uInt8 flash_on);
2518
2519/**
2520 * @brief
2521 * Intializes message waiting indicator with ramp configurability
2522 *
2523 * @details
2524 * Message waiting (neon flashing) initialization. If MWI feature has not been
2525 * enabled by calling ProSLIC_SetMWIEnable(), then this function will return
2526 * RC_MWI_NOT_ENABLED
2527 *
2528 * @note
2529 * Proper patch must be loaded for this feature to work properly. Code does not
2530 * automatically verify that this patch is loaded.
2531 *
2532 * @param[in] pProslic - channel to modify
2533 * @param[in] steps - number of steps in ramp, tick duration is time of one step
2534 * @param[in] onTime - number of ticks MWI is in the ON state
2535 * @param[in] offTime - number of ticks MWI is in the OFF state
2536 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2537 */
2538
2539int ProSLIC_MWIRampStart(proslicChanType_ptr pProslic, uInt32 steps, uInt32 onTime, uInt32 offTime);
2540
2541/**
2542 * @brief
2543 * Implements message waiting indicator with ramp between ON and OFF states
2544 *
2545 * @details
2546 * Message waiting (neon flashing) polling function. If MWI feature has not been
2547 * enabled by calling ProSLIC_SetMWIEnable(), then this function will return
2548 * RC_MWI_NOT_ENABLED
2549 *
2550 * @note
2551 * Proper patch must be loaded for this feature to work properly. Code does not
2552 * automatically verify that this patch is loaded.
2553 *
2554 * @param[in] pProslic - channel to modify
2555 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2556 */
2557
2558int ProSLIC_MWIRampPoll(proslicChanType_ptr pProslic);
2559
2560/**
2561 * @brief
2562 * Restores ramping message waiting indicator state
2563 *
2564 * @details
2565 * Message waiting (neon flashing) stop function. If MWI feature has not been
2566 * enabled by calling ProSLIC_SetMWIEnable(), then this function will return
2567 * RC_MWI_NOT_ENABLED
2568 *
2569 * @note
2570 * Proper patch must be loaded for this feature to work properly. Code does not
2571 * automatically verify that this patch is loaded.
2572 *
2573 * @param[in] pProslic - channel to modify
2574 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2575 */
2576
2577int ProSLIC_MWIRampStop(proslicChanType_ptr pProslic);
2578
2579/**
2580 * @brief
2581 * Read MWI output state
2582 *
2583 * @details
2584 * Message waiting (neon flashing) state read. If MWI feature has not been
2585 * enabled by calling ProSLIC_SetMWIEnable(), then this function will return
2586 * RC_MWI_NOT_ENABLED
2587 *
2588 * @note
2589 * Proper patch must be loaded for this feature to work properly. Code does not
2590 * automatically verify that this patch is loaded.
2591 *
2592 * @param[in] hProslic - channel to modify
2593 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2594 */
2595
2596int ProSLIC_GetMWIState(proslicChanType_ptr hProslic);
2597
2598/** @} MESSAGE_WAITING */
2599
2600/*****************************************************************************/
2601/** @defgroup MISC MISC. routines
2602 * @{
2603 */
2604
2605/**
2606 * @brief
2607 * This function initiates PLL free run mode.
2608 *
2609 * @param[in] hProslic - which channel to modify
2610 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2611 */
2612
2613int ProSLIC_PLLFreeRunStart (proslicChanType_ptr hProslic);
2614
2615/**
2616 * @brief
2617 * This function terminates PLL free run mode.
2618 *
2619 * @param[in] hProslic - which channel to modify
2620 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2621 */
2622
2623int ProSLIC_PLLFreeRunStop (proslicChanType_ptr hProslic);
2624
2625/**
2626 * @brief
2627 * This function returns PLL free run status.
2628 *
2629 * @param[in] hProslic - which channel to report upon.
2630 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2631 */
2632
2633int ProSLIC_GetPLLFreeRunStatus (proslicChanType_ptr hProslic);
2634
2635/**
2636 *
2637 * @brief
2638 * Sets the ProSLIC into User Access Mode (UAM) on parts that support this. This is mainly
2639 * used internally within the API.
2640 *
2641 * @param[in] pProslic - which channel to modify
2642 * @param[in] isEnabled - is the User Access Mode enabled (NOTE: once enabled, it can not be disabled)
2643 * @param[in] isBcast - is this a broadcast on the daisychain
2644 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
2645 */
2646int ProSLIC_SetUserMode(proslicChanType *pProslic,BOOLEAN isEnabled,
2647 BOOLEAN isBcast);
2648
2649/*
2650** @brief
2651** Checks for improper ring exit (this is used internally by the API) and
2652** not all chipsets need to call this.
2653**
2654** @param[in] pProslic - which ProSLIC to check.
2655** Returns:
2656** RC_NONE - Reinit not required
2657** RC_REINIT_REQUIRED - Corrupted state machine - reinit required
2658**
2659*/
2660int ProSLIC_isReinitRequired(proslicChanType *pProslic);
2661
2662/** @} MISC */
2663/** @} */
2664
2665/* Hopefully customer's code will never call this function... */
2666int ProSLIC_UnsupportedFeatureNoArg(proslicChanType_ptr pProslic,
2667 const char *function_name);
2668
2669/* Helper function used by PSTN routines */
2670#ifdef PSTN_DET_ENABLE
2671void ProSLIC_PSTN_delay_poll(proslicTestStateType *pState, uInt16 delay);
2672#endif
2673
2674#if defined(SI3218X) || defined(SI3226X) || defined(SI3228X) || defined(SI3217X) || defined(SI3219X)
2675int ProSLIC_Calibrate(proslicChanType_ptr *hProslic, int maxChan, uInt8 *calr,
2676 int maxTime);
2677#endif
2678/**
2679 * @brief determine if the given channel is a ProSLIC or DAA
2680 *
2681 * @param[in,out] pProslic - channel to be probed.
2682 * @retval PROSLIC | DAA | UNKNOWN
2683 */
2684int ProSLIC_identifyChannelType(proslicChanType *pProslic);
2685
2686/* The following functions are used as part of the chipset init functions, not meant to be called
2687 outside this scope.
2688*/
2689int ProSLIC_ReInit_helper(proslicChanType_ptr *pProslic, int size,
2690 initOptionsType init_option, int numChanPerDevice);
2691int ProSLIC_VerifyMasterStat(proslicChanType_ptr);
2692
2693void ProSLIC_LoadSupportRAM(proslicChanType *pProslic, uInt8 channel,
2694 const uInt16 *address, const ramData *data);
2695
2696#endif /*end ifdef PROSLIC_H*/
2697