SmartSnippets DA1459x SDK
middleware_defaults.h
Go to the documentation of this file.
1 
54 #ifndef MIDDLEWARE_DEFAULTS_H_
55 #define MIDDLEWARE_DEFAULTS_H_
56 
78 /* -------------------------------- Adapters (ad_*) selection -------------------------------- */
79 
80 #ifndef dg_configFLASH_ADAPTER
81 #define dg_configFLASH_ADAPTER (1)
82 #endif
83 
84 #ifndef dg_configI2C_ADAPTER
85 #define dg_configI2C_ADAPTER (0)
86 #endif
87 
88 #ifndef dg_configNVMS_ADAPTER
89 #define dg_configNVMS_ADAPTER (1)
90 #endif
91 
92 #ifndef dg_configNVMS_FLASH_CACHE
93 #define dg_configNVMS_FLASH_CACHE (0)
94 #endif
95 
96 #ifndef dg_configNVMS_VES
97 #define dg_configNVMS_VES (1)
98 #endif
99 
100 #ifndef dg_configSPI_ADAPTER
101 #define dg_configSPI_ADAPTER (0)
102 #endif
103 
104 #ifndef dg_configUART_ADAPTER
105 #define dg_configUART_ADAPTER (0)
106 #endif
107 
108 #ifndef dg_configGPADC_ADAPTER
109 #define dg_configGPADC_ADAPTER (0)
110 #endif
111 
112 #ifndef dg_configSDADC_ADAPTER
113 #define dg_configSDADC_ADAPTER (0)
114 #endif
115 
116 #ifdef dg_configTEMPSENS_ADAPTER
117 #error "Configuration option dg_configTEMPSENS_ADAPTER is no longer supported"
118 #endif
119 
120 #ifdef dg_configBATTERY_ADAPTER
121 #error "Configuration option dg_configBATTERY_ADAPTER is no longer supported"
122 #endif
123 
124 #ifndef dg_configNVPARAM_ADAPTER
125 #define dg_configNVPARAM_ADAPTER (0)
126 #endif
127 
128 #ifndef dg_configNVPARAM_APP_AREA
129 #define dg_configNVPARAM_APP_AREA (0)
130 #endif
131 
132 #ifndef dg_configCRYPTO_ADAPTER
133 #define dg_configCRYPTO_ADAPTER (0)
134 #endif
135 
136 #if dg_configCRYPTO_ADAPTER
137 #if !dg_configUSE_HW_AES && !dg_configUSE_HW_HASH
138 #error "The Crypto adapter requires hw_aes or/and hw_hash"
139 #endif
140 #endif
141 
142 #ifndef dg_configKEYBOARD_SCANNER_ADAPTER
143 #define dg_configKEYBOARD_SCANNER_ADAPTER (0)
144 #endif
145 
146 
147 
148 #ifndef dg_configPMU_ADAPTER
149 #define dg_configPMU_ADAPTER (1)
150 #endif
151 
152 #if (dg_configISO7816_ADAPTER == 1)
153 # error "dg_configISO7816_ADAPTER is not supported in DA1459X devices"
154 #else
155 # undef dg_configISO7816_ADAPTER
156 # define dg_configISO7816_ADAPTER (0)
157 #endif
158 
159 
160 /* ---------------------------------------------------------------------------------------------- */
161 
187 /* -------------------------------------- Console IO configuration settings --------------------- */
188 
189 #ifndef dg_configUSE_CONSOLE
190 #define dg_configUSE_CONSOLE (0)
191 #endif
192 
193 #ifndef dg_configUSE_CONSOLE_STUBS
194 #define dg_configUSE_CONSOLE_STUBS (0)
195 #endif
196 
197 #ifndef dg_configUSE_CLI
198 #define dg_configUSE_CLI (0)
199 #endif
200 
201 #ifndef dg_configUSE_CLI_STUBS
202 #define dg_configUSE_CLI_STUBS (0)
203 #endif
204 /* ---------------------------------------------------------------------------------------------- */
205 
210 /* ----------------------------- DGTL ----------------------------------------------------------- */
211 
225 #ifndef dg_configUSE_DGTL
226 #define dg_configUSE_DGTL (0)
227 #endif
228 
234 /* -------------------------------------- Debug settings ---------------------------------------- */
235 
242 #ifndef dg_configENABLE_TASK_MONITORING
243 #define dg_configENABLE_TASK_MONITORING (0)
244 #endif
245 
246 
247 
248 /* ---------------------------------------------------------------------------------------------- */
249 
250 /* ---------------------------------- OS related configuration ---------------------------------- */
251 
257 #ifndef dg_configTRACK_OS_HEAP
258 #define dg_configTRACK_OS_HEAP (0)
259 #endif
260 
261 /* ---------------------------------------------------------------------------------------------- */
262 
267 /* ---------------------------------- SYSTEM CONFIGURATION ------------------------------------ */
276 #if defined(OS_PRESENT)
277 #ifndef dg_configUSE_SYS_ADC
278 #define dg_configUSE_SYS_ADC (1)
279 #endif
280 #endif
281 
287 #ifndef dg_configUSE_SYS_BOOT
288 # if defined(OS_PRESENT) && (dg_configCODE_LOCATION != NON_VOLATILE_IS_NONE)
289 # define dg_configUSE_SYS_BOOT (1)
290 # else
291 # define dg_configUSE_SYS_BOOT (0)
292 # endif
293 #endif /* dg_configUSE_SYS_BOOT */
294 
300 #ifndef dg_configUSE_SYS_TRNG
301 #if defined(CONFIG_USE_BLE)
302 #define dg_configUSE_SYS_TRNG (1)
303 #else
304 #define dg_configUSE_SYS_TRNG (0)
305 #endif
306 #endif
307 
313 #ifndef dg_configUSE_SYS_DRBG
314 #if defined(CONFIG_USE_BLE)
315 #define dg_configUSE_SYS_DRBG (1)
316 #else
317 #define dg_configUSE_SYS_DRBG (0)
318 #endif
319 #endif
320 
328 #if (dg_configUSE_SYS_TRNG == 1)
329 # ifndef dg_configSYS_TRNG_ENTROPY_SRC_ADDR
330 # define dg_configSYS_TRNG_ENTROPY_SRC_ADDR MEMORY_CMAC_CACHERAM_BASE
331 # endif
332 #endif
333 
339 #ifndef dg_configUSE_SYS_DRBG_BUFFER_LENGTH
340 #define dg_configUSE_SYS_DRBG_BUFFER_LENGTH (30)
341 #endif
342 
350 #ifndef dg_configUSE_SYS_DRBG_BUFFER_THRESHOLD
351 #define dg_configUSE_SYS_DRBG_BUFFER_THRESHOLD (24)
352 #endif
353 
354 #if (dg_configUSE_SYS_DRBG_BUFFER_THRESHOLD >= dg_configUSE_SYS_DRBG_BUFFER_LENGTH)
355 #error "The threshold must be less than the buffer length"
356 #endif
357 
358 #if (dg_configUSE_SYS_DRBG_BUFFER_THRESHOLD <= 0)
359 #error "The threshold must be greater than zero"
360 #endif
361 
367 #ifndef dg_configUSE_CHACHA20_RAND
368 #define dg_configUSE_CHACHA20_RAND (1)
369 #endif
370 
376 #ifndef dg_configUSE_STDLIB_RAND
377 #define dg_configUSE_STDLIB_RAND (0)
378 #endif
379 
380 #if ((dg_configUSE_CHACHA20_RAND + dg_configUSE_STDLIB_RAND) != 1)
381  #error "Only one random number generator must be enabled each time."
382 #endif
383 
384 
385 /* ---------------------------------------------------------------------------------------------- */
386 
387 /* ----------------------------------- Driver dependencies -------------------------------------- */
388 
389 
390 # if dg_configUSE_SYS_ADC
391 # undef dg_configUSE_HW_GPADC
392 # define dg_configUSE_HW_GPADC (1)
393 # undef dg_configGPADC_ADAPTER
394 # define dg_configGPADC_ADAPTER (1)
395 # endif /* dg_configUSE_SYS_ADC */
396 
397 
398 
399 
400 /* If RF is enabled, we need to enable GPADC adapter as well */
401 #if dg_configRF_ADAPTER
402 #undef dg_configGPADC_ADAPTER
403 #define dg_configGPADC_ADAPTER (1)
404 #endif
405 
406 /*
407  * \brief Enable the RTC correction mechanism
408  *
409  * When RCX is set as the low power clock and Real Time Clock is used (i.e. dg_configUSE_HW_RTC is defined),
410  * setting this macro to a non-zero value enables the RTC correction mechanism.
411  * The SYS_ADC service is required to trigger the drift compensation mechanism, correcting the RTC time.
412  * The value of this macro triggers the correction every (dg_configRTC_CORRECTION * SYS_ADC_PERIOD_TICKS).
413  * A drift compensation is also applied after every RCX calibration.
414  *
415  * \note Using the fastest available system clock is recommended to achieve high RTC accuracy.
416  * This minimizes the intrinsic drift due to the correction algorithm, which is executed while the system is at wake-time.
417  *
418  * \note Although not mandatory, a power-of-2 value for this macro is advised.
419  */
420 #if (dg_configUSE_LP_CLK == LP_CLK_RCX && defined(OS_FREERTOS) && dg_configUSE_HW_RTC && dg_configUSE_SYS_ADC)
421 #ifndef dg_configRTC_CORRECTION
422 #define dg_configRTC_CORRECTION (64)
423 #endif
424 #else
425 #if dg_configRTC_CORRECTION
426 # pragma message "dg_configRTC_CORRECTION is only used in RTOS based projects when RCX is set as low power clock. Forcing to 0."
427 #undef dg_configRTC_CORRECTION
428 #define dg_configRTC_CORRECTION (0)
429 #endif
430 #endif
431 
432 #if (dg_configSPI_ADAPTER)
433 /*
434  * \brief CS configuration limit for the SPI adapter.
435  *
436  * The maximum number of available pads in multiple CS configuration.
437  *
438  * \note Up to (UINT8_MAX - 1). UINT8_MAX is reserved
439  */
440 #ifndef dg_configSPI_ADAPTER_CS_MAX
441 #define dg_configSPI_ADAPTER_CS_MAX (8)
442 #endif
443 
444 #endif
445 
446 /*
447  * If SYS_TRNG is enabled for DA1459X, is also necessary to enable the AES/HASH driver because
448  * sys_trng makes use of aes ecb encryption functionality
449  */
450 #if (dg_configUSE_SYS_TRNG == 1)
451 #undef dg_configUSE_HW_AES
452 #define dg_configUSE_HW_AES (1)
453 #endif /* dg_configUSE_SYS_TRNG */
454 /* ---------------------------------------------------------------------------------------------- */
455 
456 #endif /* MIDDLEWARE_DEFAULTS_H_ */
457