Skip to content

Commit 1e8278f

Browse files
committed
lib: vc8000nanoe: add hardware config helper
Add hardware config helper. Signed-off-by: Hugues Fruchet <[email protected]>
1 parent 64edec4 commit 1e8278f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

lib/vc8000nanoe/inc/ewl.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,35 @@ void EWLassert(bool expr, const char *str_expr, const char *file, unsigned int l
255255
void EWLtrace(const char *s);
256256
void EWLtraceparam(const char *fmt, const char *param, unsigned int val);
257257

258+
/* Build hardware configuration structure */
259+
static inline EWLHwConfig_t EWLBuildHwConfig(uint32_t cfgval, uint32_t cfgval2)
260+
{
261+
EWLHwConfig_t cfg_info;
262+
263+
cfg_info.maxEncodedWidth = cfgval & ((1U << 12U) - 1U);
264+
cfg_info.h264Enabled = (cfgval >> 27U) & 1U;
265+
cfg_info.vp8Enabled = (cfgval >> 26U) & 1U;
266+
cfg_info.jpegEnabled = (cfgval >> 25U) & 1U;
267+
cfg_info.vsEnabled = (cfgval >> 24U) & 1U;
268+
cfg_info.rgbEnabled = (cfgval >> 28U) & 1U;
269+
cfg_info.searchAreaSmall = (cfgval >> 29U) & 1U;
270+
cfg_info.scalingEnabled = (cfgval >> 30U) & 1U;
271+
cfg_info.busType = (cfgval >> 20U) & 15U;
272+
cfg_info.synthesisLanguage = (cfgval >> 16U) & 15U;
273+
cfg_info.busWidth = (cfgval >> 12U) & 15U;
274+
cfg_info.addr64Support = (cfgval2 >> 31U) & 1U;
275+
cfg_info.dnfSupport = (cfgval2 >> 30U) & 1U;
276+
cfg_info.rfcSupport = (cfgval2 >> 28U) & 3U;
277+
cfg_info.enhanceSupport = (cfgval2 >> 27U) & 1U;
278+
cfg_info.instantSupport = (cfgval2 >> 26U) & 1U;
279+
cfg_info.svctSupport = (cfgval2 >> 25U) & 1U;
280+
cfg_info.inAxiIdSupport = (cfgval2 >> 24U) & 1U;
281+
cfg_info.inLoopbackSupport = (cfgval2 >> 23U) & 1U;
282+
cfg_info.irqEnhanceSupport = (cfgval2 >> 22U) & 1U;
283+
284+
return cfg_info;
285+
}
286+
258287
#ifdef __cplusplus
259288
}
260289
#endif

0 commit comments

Comments
 (0)