blob: af9b0570e211fa6624e38292f66cbf042dd6bd93 [file] [log] [blame]
developere0cea0f2021-12-16 16:08:26 +08001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Si3218x ProSLIC interface header file
4 *
5 * Distributed by:
6 * Silicon Laboratories, Inc
7 *
8 * This file contains proprietary information.
9 * No dissemination allowed without prior written permission from
10 * Silicon Laboratories, Inc.
11 *
12 * File Description:
13 * This is the header file for the ProSLIC driver.
14 *
15 *
16 */
17
18#ifndef SI3218X_INTF_H
19#define SI3218X_INTF_H
20#include "si3218x.h"
21
22/* The following macros are for backward compatibility */
23#define Si3218x_LoadPatch ProSLIC_LoadPatch
24#define Si3218x_ReadHookStatus ProSLIC_ReadHookStatus
25#define Si3218x_DCFeedSetup(PCHAN, NDX) Si3218x_DCFeedSetupCfg((PCHAN),Si3218x_DCfeed_Presets, (NDX))
26#define Si3218x_VerifyPatch ProSLIC_VerifyPatch
27#define Si3218x_SetPowersaveMode ProSLIC_SetPowersaveMode
28#define Si3218x_Init(PCHAN, SZ) Si3218x_Init_with_Options((PCHAN), (SZ), INIT_NO_OPT)
29#define Si3218x_LoadRegTables ProSLIC_LoadRegTables
30#define Si3218x_VerifyControlInterface ProSLIC_VefifyControlInterface
31#define Si3218x_ShutdownChannel ProSLIC_PowerDownConverter
32#define Si3218x_PowerDownConverter ProSLIC_PowerDownConverter
33#define Si3218x_Calibrate ProSLIC_Calibrate
34#define Si3218x_SetLinefeedStatusBroadcast ProSLIC_SetLinefeedStatusBroadcast
35#define Si3218x_SetLinefeedStatus ProSLIC_SetLinefeedStatus
36#define Si3218x_MWIEnable ProSLIC_MWIEnable
37#define Si3218x_MWIDisable ProSLIC_MWIDisable
38#define Si3218x_SetMWIState ProSLIC_SetMWIState
39#define Si3218x_GetMWIState ProSLIC_GetMWIState
40#define Si3218x_MWISetup(PCHAN,VPK,LCR) ProSLIC_MWISetV(PCHAN,VPK)
41
42/* DC Feed */
43#ifndef DISABLE_DCFEED_SETUP
44extern Si3218x_DCfeed_Cfg Si3218x_DCfeed_Presets[];
45#endif
46
47/*
48**
49** PROSLIC INITIALIZATION FUNCTIONS
50**
51*/
52
53/*
54** Function: PROSLIC_Init_MultiBOM
55**
56** Description:
57** Initializes the ProSLIC w/ selected general parameters
58**
59** Input Parameters:
60** pProslic: pointer to PROSLIC object
61** size: number of channels
62** preset: General configuration preset
63**
64** Return:
65** none
66*/
67#ifdef SIVOICE_MULTI_BOM_SUPPORT
68int Si3218x_Init_MultiBOM (proslicChanType_ptr *hProslic,int size,int preset);
69#endif
70
71/*
72** Function: Si3218x_Init_with_Options
73**
74** Description:
75** Initializes the ProSLIC with an option.
76**
77** Input Parameters:
78** pProslic: pointer to PROSLIC object
79** size - number of continuous channels to initialize
80** init_opt - which initialization type to do.
81**
82** Return:
83** none
84*/
85int Si3218x_Init_with_Options (proslicChanType_ptr *pProslic, int size,
86 initOptionsType init_opt);
87
88/*
89** Function: PROSLIC_VerifyControlInterface
90**
91** Description:
92** Verify SPI port read capabilities
93**
94** Input Parameters:
95** pProslic: pointer to PROSLIC object
96**
97** Return:
98** none
99*/
100int Si3218x_VerifyControlInterface (proslicChanType_ptr hProslic);
101
102/*
103** Function: Si3218x_PowerUpConverter
104**
105** Description:
106** Powers all DC/DC converters sequentially with delay to minimize
107** peak power draw on VDC.
108**
109** Returns:
110** int (error)
111**
112*/
113int Si3218x_PowerUpConverter(proslicChanType_ptr hProslic);
114
115/*
116** Function: Si3218x_PowerDownConverter
117**
118** Description:
119** Power down DCDC converter (selected channel only)
120**
121** Returns:
122** int (error)
123**
124*/
125int Si3218x_PowerDownConverter(proslicChanType_ptr hProslic);
126
127/*
128** Function: PROSLIC_EnableInterrupts
129**
130** Description:
131** Enables interrupts
132**
133** Input Parameters:
134** hProslic: pointer to Proslic object
135**
136** Return:
137**
138*/
139int Si3218x_EnableInterrupts (proslicChanType_ptr hProslic);
140
141/*
142**
143** PROSLIC CONFIGURATION FUNCTIONS
144**
145*/
146
147/*
148** Function: PROSLIC_RingSetup
149**
150** Description:
151** configure ringing
152**
153** Input Parameters:
154** pProslic: pointer to Proslic object
155** pRingSetup: pointer to ringing config structure
156**
157** Return:
158** none
159*/
160int Si3218x_RingSetup (proslicChanType *pProslic, int preset);
161
162/*
163** Function: PROSLIC_ZsynthSetup
164**
165** Description:
166** configure impedance synthesis
167**
168** Input Parameters:
169** pProslic: pointer to Proslic object
170** pZynth: pointer to zsynth config structure
171**
172** Return:
173** none
174*/
175int Si3218x_ZsynthSetup (proslicChanType *pProslic, int preset);
176
177/*
178** Function: PROSLIC_AudioGainSetup
179**
180** Description:
181** configure audio gains
182**
183** Input Parameters:
184** pProslic: pointer to Proslic object
185** preset: impedance preset to scale
186**
187** Return:
188** none
189*/
190int Si3218x_TXAudioGainSetup (proslicChanType *pProslic, int preset);
191int Si3218x_RXAudioGainSetup (proslicChanType *pProslic, int preset);
192#define Si3218x_AudioGainSetup ProSLIC_AudioGainSetup
193
194/*
195** Function: PROSLIC_TXAudioGainScale
196**
197** Description:
198** configure audio gains
199**
200** Input Parameters:
201** pProslic: pointer to Proslic object
202** preset: pointer to audio gains config structure
203** pga_scale: pga_scaling constant
204** eq_scale: equalizer scaling constant
205**
206** Return:
207** none
208*/
209int Si3218x_TXAudioGainScale (proslicChanType *pProslic, int preset,
210 uInt32 pga_scale, uInt32 eq_scale);
211
212/*
213** Function: PROSLIC_RXAudioGainScale
214**
215** Description:
216** configure audio gains
217**
218** Input Parameters:
219** pProslic: pointer to Proslic object
220** preset: pointer to audio gains config structure
221** pga_scale: pga_scaling constant
222** eq_scale: equalizer scaling constant
223**
224** Return:
225** none
226*/
227int Si3218x_RXAudioGainScale (proslicChanType *pProslic, int preset,
228 uInt32 pga_scale, uInt32 eq_scale);
229
230/*
231** Function: PROSLIC_AudioEQSetup
232**
233** Description:
234** configure audio equalizers
235**
236** Input Parameters:
237** pProslic: pointer to Proslic object
238** pAudioEQ: pointer to ringing config structure
239**
240** Return:
241** none
242*/
243int Si3218x_AudioEQSetup (proslicChanType *pProslic, int preset);
244
245/*
246** Function: PROSLIC_DCFeedSetup
247**
248** Description:
249** configure dc feed
250**
251** Input Parameters:
252** pProslic: pointer to Proslic object
253** pDcFeed: pointer to dc feed config structure
254**
255** Return:
256** none
257*/
258int Si3218x_DCFeedSetupCfg (proslicChanType *pProslic, ProSLIC_DCfeed_Cfg *cfg,
259 int preset);
260
261/*
262** Function: PROSLIC_PCMSetup
263**
264** Description:
265** configure pcm
266**
267** Input Parameters:
268** pProslic: pointer to Proslic object
269** pPcm: pointer to pcm config structure
270**
271** Return:
272** none
273*/
274int Si3218x_PCMSetup(proslicChanType *pProslic, int preset);
275
276/*
277**
278** PROSLIC CONTROL FUNCTIONS
279**
280*/
281
282/*
283** Function: PROSLIC_GetInterrupts
284**
285** Description:
286** Enables interrupts
287**
288** Input Parameters:
289** hProslic: pointer to Proslic object
290** pIntData: pointer to interrupt info retrieved
291**
292** Return:
293**
294*/
295int Si3218x_GetInterrupts (proslicChanType_ptr hProslic,
296 proslicIntType *pIntData);
297
298/*
299** Function: PROSLIC_PulseMeterSetup
300**
301** Description:
302** configure pulse metering
303**
304** Input Parameters:
305** pProslic: pointer to Proslic object
306** pPulseCfg: pointer to pulse metering config structure
307**
308** Return:
309** none
310*/
311int Si3218x_PulseMeterSetup (proslicChanType *pProslic, int preset);
312
313/*
314** Function: PROSLIC_dbgSetDCFeed
315**
316** Description:
317** provision function for setting up
318** dcfeed given desired open circuit voltage
319** and loop current.
320*/
321int Si3218x_dbgSetDCFeed (proslicChanType *pProslic, uInt32 v_vlim_val,
322 uInt32 i_ilim_val, int32 preset);
323
324/*
325** Function: PROSLIC_dbgSetDCFeedVopen
326**
327** Description:
328** provision function for setting up
329** dcfeed given desired open circuit voltage
330** and loop current.
331*/
332int Si3218x_dbgSetDCFeedVopen (proslicChanType *pProslic, uInt32 v_vlim_val,
333 int32 preset);
334
335
336/*
337** Function: PROSLIC_dbgSetDCFeedIloop
338**
339** Description:
340** provision function for setting up
341** dcfeed given desired open circuit voltage
342** and loop current.
343*/
344int Si3218x_dbgSetDCFeedIloop (proslicChanType *pProslic, uInt32 i_ilim_val,
345 int32 preset);
346
347
348/*
349** Function: PROSLIC_dbgRingingSetup
350**
351** Description:
352** Provision function for setting up
353** Ring type, frequency, amplitude and dc offset.
354** Main use will be by peek/poke applications.
355*/
356int Si3218x_dbgSetRinging (proslicChanType *pProslic,
357 ProSLIC_dbgRingCfg *ringCfg, int preset);
358
359/*
360** Function: PROSLIC_dbgSetRXGain
361**
362** Description:
363** Provision function for setting up
364** RX path gain.
365*/
366int Si3218x_dbgSetRXGain (proslicChanType *pProslic, int32 gain,
367 int impedance_preset, int audio_gain_preset);
368
369/*
370** Function: PROSLIC_dbgSetTXGain
371**
372** Description:
373** Provision function for setting up
374** TX path gain.
375*/
376int Si3218x_dbgSetTXGain (proslicChanType *pProslic, int32 gain,
377 int impedance_preset, int audio_gain_preset);
378
379
380/*
381** Function: PROSLIC_LineMonitor
382**
383** Description:
384** Monitor line voltages and currents
385*/
386int Si3218x_LineMonitor(proslicChanType *pProslic, proslicMonitorType *monitor);
387
388
389/*
390** Function: PROSLIC_PSTNCheck
391**
392** Description:
393** Continuous monitor of ilong to detect hot pstn line
394*/
395int Si3218x_PSTNCheck(proslicChanType *pProslic,
396 proslicPSTNCheckObjType *pstnCheckObj);
397
398
399/*
400** Function: PROSLIC_PSTNCheck
401**
402** Description:
403** Continuous monitor of ilong to detect hot pstn line
404*/
405int Si3218x_DiffPSTNCheck(proslicChanType *pProslic,
406 proslicDiffPSTNCheckObjType *pstnCheckObj);
407
408/*
409** Function: PROSLIC_ReadMADCScaled
410**
411** Description:
412** Read MADC (or other sensed voltages/currents) and
413** return scaled value in int32 format
414*/
415int32 Si3218x_ReadMADCScaled(proslicChanType_ptr pProslic, uInt16 addr,
416 int32 scale);
417
418/*
419** Function: Si3218x_GenParamUpdate
420**
421** Description:
422** Update Si3218x general parameters and other required modifications
423** to default reg/ram values
424**
425** Returns:
426** int (error)
427**
428*/
429int Si3218x_GenParamUpdate(proslicChanType_ptr hProslic,initSeqType seq);
430
431
432/*
433** Function: Si3218x_SelectPatch
434**
435** Description:
436** Select appropriate patch based on general parameters
437**
438** Returns:
439** int (error)
440**
441*/
442int Si3218x_SelectPatch(proslicChanType_ptr hProslic,
443 const proslicPatch **patch);
444
445/*
446** Function: Si3218x_ConverterSetup
447**
448** Description:
449** Program revision specific settings before powering converter
450**
451** Specifically, from general parameters and knowledge that this
452** is Rev C, setup dcff drive, gate drive polarity, and charge pump.
453**
454** Returns:
455** int (error)
456**
457*/
458int Si3218x_ConverterSetup(proslicChanType_ptr pProslic);
459
460/*
461** Function: Si3218x8_PulseMeterSetup
462**
463** Description:
464** configure pulse metering
465*/
466int Si3218x_PulseMeterSetup (proslicChanType_ptr hProslic, int preset);
467
468
469/*
470** Function: Si3218x_GetChipInfo
471** Description: Returns the specific chipset in the Si3218x family.
472** Input parameters: channel pointer
473** output: either RC_SPI_FAIL or RC_NONE. channel pointer deviceId will be updated.
474**/
475int Si3218x_GetChipInfo(proslicChanType_ptr pProslic);
476
477
478#endif
479