From 7755b6a3ee806bcaa6dd0a91620da0163b94b95b Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 15 May 2024 22:32:09 +0000 Subject: [PATCH] samples: video: capture: add support for SMARTDMA Add support for using the SMARTDMA engine on the FRDM-MCXN947 board with the video capture sample. Signed-off-by: Daniel DeGrasse --- .../subsys/video/capture/boards/frdm_mcxn947_cpu0.conf | 5 +++++ samples/subsys/video/capture/src/main.c | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 samples/subsys/video/capture/boards/frdm_mcxn947_cpu0.conf diff --git a/samples/subsys/video/capture/boards/frdm_mcxn947_cpu0.conf b/samples/subsys/video/capture/boards/frdm_mcxn947_cpu0.conf new file mode 100644 index 000000000000000..4a604bc267ef25b --- /dev/null +++ b/samples/subsys/video/capture/boards/frdm_mcxn947_cpu0.conf @@ -0,0 +1,5 @@ +CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000 +CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=2 +# Workaround for issue where SDMA driver needs to start before camera, so that +# clock output will be generated for camera device +CONFIG_CHECK_INIT_PRIORITIES=n diff --git a/samples/subsys/video/capture/src/main.c b/samples/subsys/video/capture/src/main.c index c3c8333f67ed96e..beb0c95c5322a76 100644 --- a/samples/subsys/video/capture/src/main.c +++ b/samples/subsys/video/capture/src/main.c @@ -41,6 +41,15 @@ int main(void) return 0; } + video = dev; +#elif defined(CONFIG_VIDEO_MCUX_SDMA) + const struct device *const dev = DEVICE_DT_GET_ONE(nxp_video_smartdma); + + if (!device_is_ready(dev)) { + LOG_ERR("%s: device not ready.\n", dev->name); + return 0; + } + video = dev; #endif @@ -78,6 +87,7 @@ int main(void) (char)(fmt.pixelformat >> 24), fmt.width, fmt.height); + /* Size to allocate for each buffer */ bsize = fmt.pitch * fmt.height / caps.vbuf_per_frame;