blob: d75a2ef4bc6dc9f1eb090f6e2d3bc21280a5b2d1 [file] [log] [blame]
developere0cea0f2021-12-16 16:08:26 +08001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Author(s):
4 * laj
5 *
6 * Distributed by:
7 * Silicon Laboratories, Inc
8 *
9 * This file contains proprietary information.
10 * No dissemination allowed without prior written permission from
11 * Silicon Laboratories, Inc.
12 *
13 *
14 */
15#ifndef PROSLIC_API_CFG
16#define PROSLIC_API_CFG
17
18/** @defgroup PROSLIC_CFG ProSLIC Configuration Options
19 * @{
20 */
21
22/** @defgroup PROSLIC_DRIVER_SEL ProSLIC Driver Selection
23* Define device driver to be compiled.
24* @{
25*/
26#ifdef PROSLIC_DOXYGEN
27#define SI3217X /**< Define to support Si3217x chipset family in the build */
28#undef SI3217X
29#define SI3217X_REVC_ONLY /**< Define to ONLY have Si3217x Rev C support (drop Rev B support) */
30#undef SI3217X_REVC_ONLY
31#define SI3217X_REVB_ONLY /**< Define to ONLY have Si3217x Rev B support (drop Rev C support) */
32#undef SI3217X_REVB_ONLY
33#define SI3218X /**< Define to support Si3218x chipset family in the build */
34#undef SI3218X
35#define SI3219X /**< Define to support Si3219x chipset family in the build */
36#undef SI3219X
37#define SI3226X /**< Define to support Si3226x chipset family in the build */
38#undef SI3226X
39#define SI3228X /**< Define to support Si3228x chipset family in the build */
40#undef SI3228X
41#error DO NOT BUILD WITH PROSLIC_DOXYGEN ENABLED
42#endif
43
44/** @} PROSLIC_DRIVER_SEL*/
45
46/** @defgroup CODE_OPTS Code feature options
47 * Select which options NOT to build - just uncomment out the undef to disable feature.
48 * @{
49 */
50#define DISABLE_VERIFY_PATCH /**< Disable patch load verification */
51#undef DISABLE_VERIFY_PATCH
52#define DISABLE_FSK_SETUP /**< Disable the FSK setup & associated functions */
53#undef DISABLE_FSK_SETUP
54#define DISABLE_TONE_SETUP /**< Disable Tone setup API */
55#undef DISABLE_TONE_SETUP
56#define DISABLE_RING_SETUP /**< Disable Ring setup API */
57#undef DISABLE_RING_SETUP
58#define DISABLE_DCFEED_SETUP /**< Disable DC FEED setup API */
59#undef DISABLE_DCFEED_SETUP
60#define DISABLE_GPIO_SETUP /**< Disable GPIO setup API */
61#undef DISABLE_GPIO_SETUP
62#define DISABLE_PCM_SETUP /**< Disable PCM setup API */
63#undef DISABLE_PCM_SETUP
64#define ENABLE_DEBUG /**< Enable debug messages - function entry, etc. */
65/* #undef ENABLE_DEBUG */
66#define DISABLE_CI_SETUP /**< Disable CI Setup */
67#undef DISABLE_CI_SETUP
68#define DISABLE_ZSYNTH_SETUP /**< Disable Zsyth/impedance setup */
69#undef DISABLE_ZSYNTH_SETUP
70#define DISABLE_MALLOC /**< Don't use MALLOC/FREE, instead assume user will statically allocate */
71#undef DISABLE_MALLOC
72#define DISABLE_HPF_WIDEBAND /**< Disable RX and TX HPF when in WIDEBAND mode */
73#undef DISABLE_HPF_WIDEBAND
74#define PROSLIC_OPTIMIZE_INTERRUPTS /**< Enable optimization for interrupts for dual channel devices. This
75 optimization assumes channel number is on even boundaries - that is
76 0,2,4, are the first channel for each dual channel devices.
77 */
78#define ENABLE_TRACES /**< Enable this to see major API calls during software execution. NOT recommended for production code since it does add code space + can generate compiler warnings. */
79#undef ENABLE_TRACES
80
81#define SI_ENABLE_LOGGING /**< This will enable the ability to log to a file - this assumes the application supports this. See api_demo for example implementation */
82#undef SI_ENABLE_LOGGING
83
84#define DISABLE_HOOKCHANGE /**< Disable ProSLIC_HookChangeDetect() and associated functions */
85#undef DISABLE_HOOKCHANGE
86
87#define DISABLE_PULSEMETERING /**< Disable pulse metering functions */
88#undef DISABLE_PULSEMETERING
89
90/**@} */
91
92
93#define SIVOICE_NEON_MWI_SUPPORT /**< Enable NEON Message Waiting Indicator support */
94#undef SIVOICE_NEON_MWI_SUPPORT
95
96#define GCI_MODE /**< Set if GCI vs. SPI/PCM mode is to be used */
97#undef GCI_MODE
98
99#define ENABLE_HIRES_GAIN /**< Set for zsynth preset gains in dB*10 rather than dB */
100#undef ENABLE_HIRES_GAIN
101
102#define PRINT_TO_STRING 0 /**< Set this to 1 if printing to a string buffer vs. console - you may change/remove this*/
103
104
105/** @defgroup MULTI_BOM Multiple Device/BOM Option Support
106 * Assign patch structure names to macros used in device drivers
107* @{ */
108#define SIVOICE_MULTI_BOM_SUPPORT /**< Enable Multiple General Configuration Support */
109#undef SIVOICE_MULTI_BOM_SUPPORT
110
111#ifdef SIVOICE_MULTI_BOM_SUPPORT
112#define SI3217X_PATCH_B_FLBK si3217xPatchRevBFlbk /**< Si3217x B Flyback DCDC Converter patch */
113#define SI3217X_PATCH_B_BKBT si3217xPatchRevBBkbt /**< Si3217x B Buck-boost DCDC Converter patch */
114#define SI3217X_PATCH_B_PBB si3217xPatchRevBBkbt /**< Si3217x B PMOS Buck-boost DCDC Converter patch */
115#define SI3217X_PATCH_B_LCQCUK si3217xPatchRevBFlbk /**< Si3217x C Quasi-CUK DCDC Converter patch */
116#define SI3217X_PATCH_C_FLBK si3217xPatchRevCFlbk /**< Si3217x C Flyback DCDC Converter patch */
117#define SI3217X_PATCH_C_BKBT si3217xPatchRevCFlbk /**< Si3217x C Buck-boost DCDC Converter patch */
118#define SI3217X_PATCH_C_PBB si3217xPatchRevCFlbk /**< Si3217x C PMOS Buck-boost DCDC Converter patch */
119#define SI3217X_PATCH_C_LCQCUK si3217xPatchRevCFlbk /**< Si3217x C Quasi-CUK DCDC Converter patch */
120
121#define SI3218X_PATCH_A si3218xPatchRevALCQC /**< Si3218x LCQC 5W DCDC Converter patch */
122
123#define SI3219X_PATCH_A si3219xPatchRevALCQC /**< SI3219x patch */
124
125#define SI3226X_PATCH_C_FLBK si3226xPatchRevCFlbk /**< Si3226x RevC Flyback DCDC Converter Patch */
126#define SI3226X_PATCH_C_CUK si3226xPatchRevCFlbk /**< Si3226x RevC Full CUK DCDC Converter Patch */
127#define SI3226X_PATCH_C_QCUK si3226xPatchRevCFlbk /**< Si3226x RevC Quasi-CUK DCDC Converter Patch */
128#define SI3226X_PATCH_C_LCQCUK si3226xPatchRevCFlbk /**< Si3226x RevC Low-cost QCUK DCDC Converter Patch */
129#define SI3226X_PATCH_C_TSS si3226xPatchRevCTss /**< Si3226x RevC TSS DCDC Converter Patch */
130#define SI3226X_PATCH_C_TSS_ISO si3226xPatchRevCTssIso /**< Si3226x RevC TSS (isolated) DCDC Converter Patch */
131#define SI3226X_PATCH_C_PBB si3226xPatchRevCFlbk /**< Si3226x PMOS Buck-boost DCDC Converter patch */
132#define SI3226x_PATCH_C_FIXRL SI3226X_PATCH_C_TSS
133#define SI3226X_PATCH_C_QSS si3226xPatchRevCTss /**< Si3226x RevC QSS DCDC Converter Patch */
134#define SI3226X_PATCH_C_BB si3226xPatchRevCFlbk /**< Si3226x BJT Buck-boost DCDC Converter patch */
135
136#define SI3228X_PATCH_A si3228xPatchRevALCQC /**< Si3228x LCQC 5W DCDC Converter patch */
137
138#endif
139
140/* Default patch names for backwards compatibility */
141#define SI3217X_PATCH_B_DEFAULT RevBPatch
142#define SI3217X_PATCH_C_DEFAULT RevCPatch
143#define SI3218X_PATCH_A_DEFAULT RevAPatch
144#define SI3219X_PATCH_A_DEFAULT RevAPatch
145#define SI3226X_PATCH_C_DEFAULT RevCPatch
146#define SI3228X_PATCH_A_DEFAULT RevAPatch
147
148/** @} MULTI_BOM */
149
150
151#include <linux/module.h>
152#define LOGPRINT(...) printk(KERN_ERR __VA_ARGS__)
153#ifdef SI_ENABLE_LOGGING
154
155#ifdef PROSLIC_LINUX_KERNEL
156#error "Logging currently implemented only for userspace programs."
157#endif
158
159extern FILE *SILABS_LOG_FP; /* This global variable would need to be initialized by the user's program - see the api demo for example */
160#endif /* SI_ENABLE_LOGGING */
161
162#ifdef ENABLE_DEBUG
163#define DEBUG_ENABLED(X) ((X)->debugMode & 1)
164
165#ifdef SI_ENABLE_LOGGING
166#define DEBUG_PRINT(CHPTR,...) if( DEBUG_ENABLED(CHPTR) ){ fprintf(SILABS_LOG_FP, __VA_ARGS__); fflush(SILABS_LOG_FP);}
167#else
168#define DEBUG_PRINT(CHPTR,...) if( DEBUG_ENABLED(CHPTR) ) LOGPRINT(__VA_ARGS__)
169#endif /* Logging */
170
171#else /* No Debug */
172/* Handled in si_voice.h */
173#endif
174#define SI_ENABLE_LOGGING
175#ifdef ENABLE_TRACES
176#define TRACE_ENABLED(X) ((X)->debugMode & 2)
177
178#ifdef SI_ENABLE_LOGGING
179#define TRACEPRINT(CHPTR,FMT,...) if(TRACE_ENABLED(CHPTR)) {fprintf(SILABS_LOG_FP, "#TRC:%s channel: %d "FMT,__FUNCTION__, (CHPTR)->channel,__VA_ARGS__); fflush(SILABS_LOG_FP); }
180#define TRACEPRINT_NOCHAN(FMT,...) fprintf(SILABS_LOG_FP, "#TRC:%s "FMT,__FUNCTION__, __VA_ARGS__); fflush(SILABS_LOG_FP)
181#else
182#define TRACEPRINT(CHPTR,FMT,...) if(TRACE_ENABLED(CHPTR)) LOGPRINT("TRC:%s channel: %d "FMT,__FUNCTION__, (CHPTR)->channel,__VA_ARGS__)
183#define TRACEPRINT_NOCHAN(FMT,...) LOGPRINT("TRC:%s "FMT,__FUNCTION__, __VA_ARGS__)
184
185#endif /* SI_ENABLE_LOGGING */
186#else
187/* Handled in si_voice.h */
188#endif
189
190
191/** @defgroup PSTN_CFG PSTN Detection Options
192* @{ */
193#define PSTN_DET_ENABLE /**< Define to include Differential PSTN detection code */
194#undef PSTN_DET_ENABLE
195
196#define PSTN_DET_OPEN_FEMF_SETTLE 1500 /**< OPEN foreign voltage measurement settle time */
197#define PSTN_DET_DIFF_SAMPLES 4 /**< Number of I/V samples averaged [1 to 16] */
198#define PSTN_DET_MIN_ILOOP 700 /**< Minimum acceptable loop current */
199#define PSTN_DET_MAX_FEMF 10000 /**< Maximum OPEN state foreign voltage */
200#define PSTN_DET_POLL_RATE 10 /**< Rate of re-entrant code in ms */
201#define PSTN_DET_DIFF_IV1_SETTLE 1000 /**< Settle time before first I/V measurment in ms */
202#define PSTN_DET_DIFF_IV2_SETTLE 1000 /**< Settle time before first I/V measurment in ms */
203
204/** @} PSTN_CFG */
205#define SIVOICE_CFG_NEWTYPES_ONLY 1 /**< Set if not supporting Legacy types */
206
207
208/**@} */
209#endif
210