blob: 622999e630869d12c6638beebbcc7fe3bf7b8c23 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/*
2** Copyright (c) 2007-2017 by Silicon Laboratories
3**
4** $Id: si3217x_intf.h 6437 2017-04-25 23:35:31Z nizajerk $
5**
6** Si3217x_Intf.h
7** Si3217x ProSLIC interface header file
8**
9** Author(s):
10** laj
11**
12** Distributed by:
13** Silicon Laboratories, Inc
14**
15** This file contains proprietary information.
16** No dissemination allowed without prior written permission from
17** Silicon Laboratories, Inc.
18**
19** File Description:
20** This is the header file for the ProSLIC driver.
21**
22**
23*/
24
25#ifndef SI3217X_INTF_H
26#define SI3217X_INTF_H
27
28
29/* The following macros are for backward compatibility */
30#define Si3217x_CheckCIDBuffer ProSLIC_CheckCIDBuffer
31#define Si3217x_DCFeedSetup(PCHAN, NDX) Si3217x_DCFeedSetupCfg((PCHAN),Si3217x_DCfeed_Presets, (NDX))
32#define Si3217x_DisableCID ProSLIC_DisableCID
33#define Si3217x_DisableInterrupts ProSLIC_DisableInterrupts
34#define Si3217x_DTMFReadDigit ProSLIC_DTMFReadDigit
35#define Si3217x_EnableCID ProSLIC_EnableCID
36#define Si3217x_GetInterrupts ProSLIC_GetInterrupts
37#define Si3217x_GetLBCalResult ProSLIC_GetLBCalResult
38#define Si3217x_GetLBCalResultPacked ProSLIC_GetLBCalResultPacked
39#define Si3217x_GetPLLFreeRunStatus ProSLIC_GetPLLFreeRunStatus
40#define Si3217x_GPIOControl ProSLIC_GPIOControl
41#define Si3217x_Init(PCHAN, SZ) Si3217x_Init_with_Options((PCHAN), (SZ), INIT_NO_OPT)
42#define Si3217x_LoadPatch ProSLIC_LoadPatch
43#define Si3217x_LoadPreviousLBCal ProSLIC_LoadPreviousLBCal
44#define Si3217x_LoadPreviousLBCalPacked ProSLIC_LoadPreviousLBCalPacked
45#define Si3217x_LoadRegTables ProSLIC_LoadRegTables
46#define Si3217x_ModemDetSetup(PCH, NDX) ProSLIC_UnsupportedFeatureNoArg((PCH), "Si3217x_ModemDetSetup")
47#define Si3217x_ModifyCIDStartBits ProSLIC_ModifyCIDStartBits
48#define Si3217x_PCMStart ProSLIC_PCMStart
49#define Si3217x_PCMStop ProSLIC_PCMStop
50#define Si3217x_PCMTimeSlotSetup ProSLIC_PCMTimeSlotSetup
51#define Si3217x_PLLFreeRunStart ProSLIC_PLLFreeRunStart
52#define Si3217x_PLLFreeRunStop ProSLIC_PLLFreeRunStop
53#define Si3217x_PolRev ProSLIC_PolRev
54#define Si3217x_PringDebugRAM ProSLIC_PrintDebugRAM
55#define Si3217x_PrintDebugData ProSLIC_PrintDebugData
56#define Si3217x_PrintDebugReg ProSLIC_PrintDebugReg
57#define Si3217x_PulseMeterDisable ProSLIC_PulseMeterDisable
58#define Si3217x_PulseMeterEnable ProSLIC_PulseMeterEnable
59#define Si3217x_PulseMeterStart ProSLIC_PulseMeterStart
60#define Si3217x_PulseMeterStop ProSLIC_PulseMeterStop
61#define Si3217x_ReadHookStatus ProSLIC_ReadHookStatus
62#define Si3217x_ReadRAM ProSLIC_ReadRAM
63#define Si3217x_ReadReg ProSLIC_ReadReg
64#define Si3217x_Reset SiVoice_Reset
65#define Si3217x_RingStart ProSLIC_RingStart
66#define Si3217x_RingStop ProSLIC_RingStop
67#define Si3217x_SendCID ProSLIC_SendCID
68#define Si3217x_SetLoopbackMode ProSLIC_SetLoopbackMode
69#define Si3217x_SetMuteStatus ProSLIC_SetMuteStatus
70#define Si3217x_SetPowersaveMode ProSLIC_SetPowersaveMode
71#define Si3217x_SetProfile(PCH, PRESET) ProSLIC_UnsupportedFeatureNoArg((PCH), "Si3217x_SetProfile")
72#define Si3217x_ToneGenStart ProSLIC_ToneGenStart
73#define Si3217x_ToneGenStop ProSLIC_ToneGenStop
74#define Si3217x_VerifyPatch ProSLIC_VerifyPatch
75#define Si3217x_WriteRAM ProSLIC_WriteRAM
76#define Si3217x_WriteReg ProSLIC_WriteReg
77#define Si3217x_VerifyControlInterface ProSLIC_VefifyControlInterface
78#define Si3217x_ShutdownChannel ProSLIC_PowerDownConverter
79#define Si3217x_PowerDownConverter ProSLIC_PowerDownConverter
80#define Si3217x_ToneGenSetup ProSLIC_ToneGenSetup
81#define Si3217x_FSKSetup ProSLIC_FSKSetup
82#define Si3217x_SetLinefeedStatusBroadcast ProSLIC_SetLinefeedStatusBroadcast
83#define Si3217x_SetLinefeedStatus ProSLIC_SetLinefeedStatus
84
85#define Si3217x_MWIEnable ProSLIC_MWIEnable
86#define Si3217x_MWIDisable ProSLIC_MWIDisable
87#define Si3217x_SetMWIState ProSLIC_SetMWIState
88#define Si3217x_GetMWIState ProSLIC_GetMWIState
89#define Si3217x_MWISetup(PCHAN,VPK,LCR) ProSLIC_MWISetV(PCHAN,VPK)
90
91
92/* DC Feed */
93#ifndef DISABLE_DCFEED_SETUP
94extern Si3217x_DCfeed_Cfg Si3217x_DCfeed_Presets[];
95#endif
96/*
97**
98** PROSLIC INITIALIZATION FUNCTIONS
99**
100*/
101
102/*
103** Function: PROSLIC_ShutdownChannel
104**
105** Description:
106** Safely shutdown channel w/o interruption to
107** other active channels
108**
109** Input Parameters:
110** pProslic: pointer to PROSLIC object
111**
112** Return:
113** none
114*/
115int Si3217x_ShutdownChannel (proslicChanType_ptr hProslic);
116
117/*
118** Function: PROSLIC_Init_MultiBOM
119**
120** Description:
121** Initializes the ProSLIC w/ selected general parameters
122**
123** Input Parameters:
124** pProslic: pointer to PROSLIC object
125** size: number of channels
126** preset: General configuration preset
127**
128** Return:
129** none
130*/
131#ifdef SIVOICE_MULTI_BOM_SUPPORT
132int Si3217x_Init_MultiBOM (proslicChanType_ptr *hProslic,int size,int preset);
133#endif
134
135/*
136** Function: Si3217x_Init_with_Options
137**
138** Description:
139** Initializes the ProSLIC with an option.
140**
141** Input Parameters:
142** pProslic: pointer to PROSLIC object
143** size - number of continuous channels to initialize
144** init_opt - which initialization type to do.
145**
146** Return:
147** none
148*/
149int Si3217x_Init_with_Options (proslicChanType_ptr *pProslic, int size,
150 initOptionsType init_opt);
151
152/*
153** Function: Si3217x_PowerUpConverter
154**
155** Description:
156** Powers all DC/DC converters sequentially with delay to minimize
157** peak power draw on VDC.
158**
159** Returns:
160** int (error)
161**
162*/
163int Si3217x_PowerUpConverter(proslicChanType_ptr hProslic);
164
165/*
166** Function: PROSLIC_EnableInterrupts
167**
168** Description:
169** Enables interrupts
170**
171** Input Parameters:
172** hProslic: pointer to Proslic object
173**
174** Return:
175**
176*/
177int Si3217x_EnableInterrupts (proslicChanType_ptr hProslic);
178
179/*
180**
181** PROSLIC CONFIGURATION FUNCTIONS
182**
183*/
184
185/*
186** Function: PROSLIC_RingSetup
187**
188** Description:
189** configure ringing
190**
191** Input Parameters:
192** pProslic: pointer to Proslic object
193** pRingSetup: pointer to ringing config structure
194**
195** Return:
196** none
197*/
198int Si3217x_RingSetup (proslicChanType *pProslic, int preset);
199
200/*
201** Function: PROSLIC_DTMFDecodeSetup
202**
203** Description:
204** configure dtmf decode
205**
206** Input Parameters:
207** pProslic: pointer to Proslic object
208** pDTMFDec: pointer to dtmf decoder config structure
209**
210** Return:
211** none
212*/
213int Si3217x_DTMFDecodeSetup (proslicChanType *pProslic, int preset);
214
215/*
216** Function: PROSLIC_ZsynthSetup
217**
218** Description:
219** configure impedance synthesis
220**
221** Input Parameters:
222** pProslic: pointer to Proslic object
223** pZynth: pointer to zsynth config structure
224**
225** Return:
226** none
227*/
228int Si3217x_ZsynthSetup (proslicChanType *pProslic, int preset);
229
230/*
231** Function: PROSLIC_GciCISetup
232**
233** Description:
234** configure CI bits (GCI mode)
235**
236** Input Parameters:
237** pProslic: pointer to Proslic object
238** pCI: pointer to ringing config structure
239**
240** Return:
241** none
242*/
243int Si3217x_GciCISetup (proslicChanType *pProslic, int preset);
244
245/*
246** Function: PROSLIC_AudioGainSetup
247**
248** Description:
249** configure audio gains
250**
251** Input Parameters:
252** pProslic: pointer to Proslic object
253** preset: impedance preset to scale
254**
255** Return:
256** none
257*/
258int Si3217x_TXAudioGainSetup (proslicChanType *pProslic, int preset);
259int Si3217x_RXAudioGainSetup (proslicChanType *pProslic, int preset);
260#define Si3217x_AudioGainSetup ProSLIC_AudioGainSetup
261
262/*
263** Function: PROSLIC_TXAudioGainScale
264**
265** Description:
266** configure audio gains
267**
268** Input Parameters:
269** pProslic: pointer to Proslic object
270** preset: pointer to audio gains config structure
271** pga_scale: pga_scaling constant
272** eq_scale: equalizer scaling constant
273**
274** Return:
275** none
276*/
277int Si3217x_TXAudioGainScale (proslicChanType *pProslic, int preset,
278 uInt32 pga_scale, uInt32 eq_scale);
279
280/*
281** Function: PROSLIC_RXAudioGainScale
282**
283** Description:
284** configure audio gains
285**
286** Input Parameters:
287** pProslic: pointer to Proslic object
288** preset: pointer to audio gains config structure
289** pga_scale: pga_scaling constant
290** eq_scale: equalizer scaling constant
291**
292** Return:
293** none
294*/
295int Si3217x_RXAudioGainScale (proslicChanType *pProslic, int preset,
296 uInt32 pga_scale, uInt32 eq_scale);
297
298/*
299** Function: PROSLIC_AudioEQSetup
300**
301** Description:
302** configure audio equalizers
303**
304** Input Parameters:
305** pProslic: pointer to Proslic object
306** pAudioEQ: pointer to ringing config structure
307**
308** Return:
309** none
310*/
311int Si3217x_AudioEQSetup (proslicChanType *pProslic, int preset);
312
313/*
314** Function: PROSLIC_DCFeedSetup
315**
316** Description:
317** configure dc feed
318**
319** Input Parameters:
320** pProslic: pointer to Proslic object
321** pDcFeed: pointer to dc feed config structure
322**
323** Return:
324** none
325*/
326int Si3217x_DCFeedSetupCfg (proslicChanType *pProslic, ProSLIC_DCfeed_Cfg *cfg,
327 int preset);
328
329/*
330** Function: PROSLIC_GPIOSetup
331**
332** Description:
333** configure gpio
334**
335** Input Parameters:
336** pProslic: pointer to Proslic object
337** pGpio: pointer to gpio config structure
338**
339** Return:
340** none
341*/
342int Si3217x_GPIOSetup (proslicChanType *pProslic);
343
344/*
345** Function: PROSLIC_PCMSetup
346**
347** Description:
348** configure pcm
349**
350** Input Parameters:
351** pProslic: pointer to Proslic object
352** pPcm: pointer to pcm config structure
353**
354** Return:
355** none
356*/
357int Si3217x_PCMSetup(proslicChanType *pProslic, int preset);
358
359/*
360**
361** PROSLIC CONTROL FUNCTIONS
362**
363*/
364
365/*
366** Function: PROSLIC_GetInterrupts
367**
368** Description:
369** Enables interrupts
370**
371** Input Parameters:
372** hProslic: pointer to Proslic object
373** pIntData: pointer to interrupt info retrieved
374**
375** Return:
376**
377*/
378int Si3217x_GetInterrupts (proslicChanType_ptr hProslic,
379 proslicIntType *pIntData);
380
381/*
382** Function: PROSLIC_PulseMeterSetup
383**
384** Description:
385** configure pulse metering
386**
387** Input Parameters:
388** pProslic: pointer to Proslic object
389** pPulseCfg: pointer to pulse metering config structure
390**
391** Return:
392** none
393*/
394int Si3217x_PulseMeterSetup (proslicChanType *pProslic, int preset);
395
396/*
397** Function: PROSLIC_dbgSetDCFeed
398**
399** Description:
400** provision function for setting up
401** dcfeed given desired open circuit voltage
402** and loop current.
403*/
404int Si3217x_dbgSetDCFeed (proslicChanType *pProslic, uInt32 v_vlim_val,
405 uInt32 i_ilim_val, int32 preset);
406
407/*
408** Function: PROSLIC_dbgSetDCFeedVopen
409**
410** Description:
411** provision function for setting up
412** dcfeed given desired open circuit voltage
413** and loop current.
414*/
415int Si3217x_dbgSetDCFeedVopen (proslicChanType *pProslic, uInt32 v_vlim_val,
416 int32 preset);
417
418
419/*
420** Function: PROSLIC_dbgSetDCFeedIloop
421**
422** Description:
423** provision function for setting up
424** dcfeed given desired open circuit voltage
425** and loop current.
426*/
427int Si3217x_dbgSetDCFeedIloop (proslicChanType *pProslic, uInt32 i_ilim_val,
428 int32 preset);
429
430
431/*
432** Function: PROSLIC_dbgRingingSetup
433**
434** Description:
435** Provision function for setting up
436** Ring type, frequency, amplitude and dc offset.
437** Main use will be by peek/poke applications.
438*/
439int Si3217x_dbgSetRinging (proslicChanType *pProslic,
440 ProSLIC_dbgRingCfg *ringCfg, int preset);
441
442/*
443** Function: PROSLIC_dbgSetRXGain
444**
445** Description:
446** Provision function for setting up
447** RX path gain.
448*/
449int Si3217x_dbgSetRXGain (proslicChanType *pProslic, int32 gain,
450 int impedance_preset, int audio_gain_preset);
451
452/*
453** Function: PROSLIC_dbgSetTXGain
454**
455** Description:
456** Provision function for setting up
457** TX path gain.
458*/
459int Si3217x_dbgSetTXGain (proslicChanType *pProslic, int32 gain,
460 int impedance_preset, int audio_gain_preset);
461
462
463/*
464** Function: PROSLIC_LineMonitor
465**
466** Description:
467** Monitor line voltages and currents
468*/
469int Si3217x_LineMonitor(proslicChanType *pProslic, proslicMonitorType *monitor);
470
471
472/*
473** Function: PROSLIC_PSTNCheck
474**
475** Description:
476** Continuous monitor of ilong to detect hot pstn line
477*/
478int Si3217x_PSTNCheck(proslicChanType *pProslic,
479 proslicPSTNCheckObjType *pstnCheckObj);
480
481
482/*
483** Function: PROSLIC_PSTNCheck
484**
485** Description:
486** Continuous monitor of ilong to detect hot pstn line
487*/
488int Si3217x_DiffPSTNCheck(proslicChanType *pProslic,
489 proslicDiffPSTNCheckObjType *pstnCheckObj);
490
491/*
492** Function: PROSLIC_ReadMADCScaled
493**
494** Description:
495** Read MADC (or other sensed voltages/currents) and
496** return scaled value in int32 format
497*/
498int32 Si3217x_ReadMADCScaled(proslicChanType_ptr pProslic, uInt16 addr,
499 int32 scale);
500
501/*
502** Function: PROSLIC_SetDAAEnable
503**
504** Description:
505** Enable FXO channel (Si32178 only)
506*/
507int Si3217x_SetDAAEnable(proslicChanType *pProslic, int enable);
508
509/*
510** Function: Si3217x_GetChipInfo
511** Description: Returns the specific chipset in the Si3217x family.
512** Input parameters: channel pointer
513** output: either RC_SPI_FAIL or RC_NONE. channel pointer deviceId will be updated.
514**/
515int Si3217x_GetChipInfo(proslicChanType_ptr pProslic);
516
517#endif
518