This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5708: Video 4 Linux vpdma list busy, cannot post

Part Number: AM5708

Hi,

We are using a AM5708 to get a video stream from the VIN2A Port.

A picture is 320x240 pixels with 12bits or 16b RAW pixel format (bits D12 to D15 are tie down by a pull-Down).

We are able tu grab a picture with the Folowing Bash Script:

# This script triggers acquistions of defined number of frames and saves then in file by using pipe.
# Optionally it can be copied to the host (with option 'T')
# Author: Martin Rechsteiner, CC ISN, HLSU T&A  (2022)


# definition of constants
mxFrames=1
HOSTIP=10.10.10.11
HOSTUSER=pi
  
fileName=tofFrames.bin

if [ "$1" == "N" ]; then
  mxFrames=$2
  echo "Number of acquistions: $mxFrames"
  if [ "$3" != "" ]; then
    fileName=$3
  fi
else
  if [ "$1" != "" ]; then
    fileName=$1
  fi
fi


echo "Linux Video-driver debug disabled"
echo 0 > /sys/class/video4linux/video1/dev_debug
echo 0 > /sys/module/videobuf2_v4l2/parameters/debug
echo 0 > /sys/module/videobuf2_common/parameters/debug

echo "start dummy video-piping in background"
cat /dev/video1 > dummyFrame &
BGND_PID=$!
usleep 500000
kill $BGND_PID
rm dummyFrame


echo "start video-piping in background"
cat /dev/video1 > $fileName &
BGND_PID=$!

echo "Trigger $ acquisitions"
for nn in `seq 1 $mxFrames`; do
  echo "Shutter $nn -----------------------------------------"
  echo 1 > /sys/class/gpio/gpio137/value
  echo 0 > /sys/class/gpio/gpio137/value
  usleep 500000
done

kill $BGND_PID
usleep 50000
echo "Piping stopped. Acquisition done. Frames written to $fileName"
ls -l $fileName

if [[ "$1" == "T" || "$2" == "T" || "$3" == "T" || "$4" == "T" || "$5" == "T" ]]; then
  scp -i ~/.ssh/id_rsa $fileName $HOSTUSER@$HOSTIP:~/SitaraBoard/transfer/.
  echo "File '$fileName' copied to host."
fi

But whats we want is to build an application in C to grab the Video Stream with V4L, the Answer is:

I_V4L_OpenVideo: Video Device: /dev/video1 Opening with Success!!!
.....[ 67.866443] vin2a-0: vpdma list busy, cannot post

The V4L driver is configurate as below:

fmt.fmt.pix.width = 640; //2*byte

fmt.fmt.pix.height = 480; //2*byte

fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_Y16;

fmt.fmt.pix.field = V4L2_FIELD_NONE;

I_V4L.h

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef I_V4L_H
#define I_V4L_H
 
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <sys/types.h>
/* Exported types ------------------------------------------------------------*/ 

/** @defgroup I_V4L_Exported_Types I_V4L Exported Types
  * @{
  */

enum io_method
{
        IO_METHOD_READ,
        IO_METHOD_MMAP,
        IO_METHOD_USERPTR,
};

struct buffer
{
        void   *start;
        size_t  length;
};

/**
  * @}
  */

/* Exported constants --------------------------------------------------------*/

/** @defgroup I_V4L_Exported_Constant I_V4L Exported Constant
  * @{
  */

#define I_V4L__DEVICE_VIDEO0 "/dev/video0"
#define I_V4L__DEVICE_VIDEO1 "/dev/video1"

/**
  * @}
  */

/* Exported macro ------------------------------------------------------------*/

/** @defgroup I_V4L_Exported_Macro I_V4L Exported Macro
  * @{
  */

/**
  * @}
  */

/* Exported functions Prototypes --------------------------------------------------------*/

/** @defgroup I_V4L_Exported_Functions_Prototypes I_V4L Exported Functions Prototypes
  * @{
  */

uint8_t I_V4L_OpenVideo(void);

uint8_t I_V4L_CloseVideo(void);

/**
  * @}
  */

#endif /* I_V4L_H */

Do you have any idea what is going wrong here?

Thanks for your support

  • here you will find the I_V4L.c file:

    /* Includes ------------------------------------------------------------------*/
    #define MODULE_NAME "I_V4L"
    #define MSG_LEVEL_FOR_APP (2)
    #include "Trace.h"
    
    #include "I_V4L.h"
    #include "I_I2C.h"
    #include "I_MEM.h"
    #include "I_TOFConfig.h"
    #include "A_Parameters.h"
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <stddef.h>
    #include <err.h>
    #include <errno.h>
    #include <string.h>
    #include <assert.h>
    
    #include <getopt.h>
    #include <fcntl.h>              /* low-level i/o */
    #include <unistd.h>
    #include <sys/stat.h>
    #include <sys/types.h>
    #include <sys/time.h>
    #include <sys/mman.h>
    #include <sys/ioctl.h>
    
    #include <linux/videodev2.h>
    /* Private typedef -----------------------------------------------------------*/
    
    /** @defgroup I_V4L_Private_TypDef I_V4L Private TypeDef
     * @{
     */
    
    /**
     * @}
     */
    
    /* Private define ------------------------------------------------------------*/
    
    /** @defgroup I_V4L_Private_Define I_V4L Private Define
     * @{
     */
    #define CLEAR(x) memset(&(x), 0, sizeof(x))
    /**
     * @}
     */
    
    /* Private macro -------------------------------------------------------------*/
    
    /** @defgroup I_V4L_Private_Macro I_V4L Private Macro
     * @{
     */
    
    /**
     * @}
     */
    
    /* Private variables ---------------------------------------------------------*/
    
    /** @defgroup I_V4L_Private_Variables I_V4L Private Variables
     * @{
     */
    
    static char  *I_V4L_pu8DeviceName_g;
    static int   u32_CamTofFileDescription_g = -1;
    
    static enum io_method   io = IO_METHOD_MMAP;
    struct buffer          *buffers;
    static unsigned int     n_buffers;
    static int              out_buf;
    static int              force_format;
    static int              frame_count = 70;
    
    /**
     * @}
     */
    
    /* Private functions prototypes -----------------------------------------------*/
    
    /** @defgroup I_V4L_Private_Functions_Prototypes I_V4L Private Function Prototypes
     * @{
     */
    static int xioctl(int fh, int request, void *arg);
    static void process_image(const void *p, int size);
    static int read_frame(void);
    static void mainloop(void);
    static void stop_capturing(void);
    static void start_capturing(void);
    static void uninit_device(void);
    static void init_read(unsigned int buffer_size);
    static void init_mmap(void);
    static void init_userp(unsigned int buffer_size);
    static void init_device(void);
    
    
    /**
     * @}
     */
    
    /* Private functions ----------------------------------------------------------*/
    
    /** @defgroup I_V4L_Private_Functions I_V4L Private Functions
     * @{
     */
    static int xioctl(int fh, int request, void *arg)
    {
    	int r;
    
    	do
    	{
    		r = ioctl(fh, request, arg);
    	} while (-1 == r && EINTR == errno);
    
    	return r;
    }
    
    static void process_image(const void *p, int size)
    {
    	if (out_buf)
    		fwrite(p, size, 1, stdout);
    
    	fflush(stderr);
    	fprintf(stderr, ".");
    	fflush(stdout);
    }
    
    static int read_frame(void)
    {
    	struct v4l2_buffer buf;
    	unsigned int i;
    
    	switch (io) {
    	case IO_METHOD_READ:
    		if (-1 == read(u32_CamTofFileDescription_g, buffers[0].start, buffers[0].length)) {
    			switch (errno) {
    			case EAGAIN:
    				return 0;
    
    			case EIO:
    				/* Could ignore EIO, see spec. */
    
    				/* fall through */
    
    			default:
    				err(errno, "Read!!");
    
    			}
    		}
    
    		process_image(buffers[0].start, buffers[0].length);
    		break;
    
    	case IO_METHOD_MMAP:
    		CLEAR(buf);
    
    		buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		buf.memory = V4L2_MEMORY_MMAP;
    
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_DQBUF, &buf)) {
    			switch (errno) {
    			case EAGAIN:
    				return 0;
    
    			case EIO:
    				/* Could ignore EIO, see spec. */
    
    				/* fall through */
    
    			default:
    				err(errno, "VIDIOC_DQBUF");
    			}
    		}
    
    		assert(buf.index < n_buffers);
    
    		process_image(buffers[buf.index].start, buf.bytesused);
    
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_QBUF, &buf))
    			err(errno, "VIDIOC_QBUF");
    		break;
    
    	case IO_METHOD_USERPTR:
    		CLEAR(buf);
    
    		buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		buf.memory = V4L2_MEMORY_USERPTR;
    
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_DQBUF, &buf)) {
    			switch (errno) {
    			case EAGAIN:
    				return 0;
    
    			case EIO:
    				/* Could ignore EIO, see spec. */
    
    				/* fall through */
    
    			default:
    				err(errno, "VIDIOC_DQBUF");
    			}
    		}
    
    		for (i = 0; i < n_buffers; ++i)
    			if (buf.m.userptr == (unsigned long)buffers[i].start
    					&& buf.length == buffers[i].length)
    				break;
    
    		assert(i < n_buffers);
    
    		process_image((void *)buf.m.userptr, buf.bytesused);
    
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_QBUF, &buf))
    			err(errno, "VIDIOC_QBUF");
    		break;
    	}
    
    	return 1;
    }
    
    static void mainloop(void)
    {
    	unsigned int count;
    
    	count = frame_count;
    
    	while (count-- > 0) {
    		for (;;) {
    			fd_set fds;
    			struct timeval tv;
    			int r;
    
    			FD_ZERO(&fds);
    			FD_SET(u32_CamTofFileDescription_g, &fds);
    
    			/* Timeout. */
    			tv.tv_sec = 2;
    			tv.tv_usec = 0;
    
    			r = select(u32_CamTofFileDescription_g + 1, &fds, NULL, NULL, &tv);
    
    			if (-1 == r) {
    				if (EINTR == errno)
    					continue;
    				err(errno, "select");
    			}
    
    			if (0 == r) {
    				fprintf(stderr, "select timeout\\n");
    				exit(EXIT_FAILURE);
    			}
    
    			if (read_frame())
    				break;
    			/* EAGAIN - continue select loop. */
    		}
    	}
    }
    
    static void stop_capturing(void)
    {
    	enum v4l2_buf_type type;
    
    	switch (io) {
    	case IO_METHOD_READ:
    		/* Nothing to do. */
    		break;
    
    	case IO_METHOD_MMAP:
    	case IO_METHOD_USERPTR:
    		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_STREAMOFF, &type))
    			err(errno, "VIDIOC_STREAMOFF");
    		break;
    	}
    }
    
    static void start_capturing(void)
    {
    	unsigned int i;
    	enum v4l2_buf_type type;
    
    	switch (io) {
    	case IO_METHOD_READ:
    		/* Nothing to do. */
    		break;
    
    	case IO_METHOD_MMAP:
    		for (i = 0; i < n_buffers; ++i) {
    			struct v4l2_buffer buf;
    
    			CLEAR(buf);
    			buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    			buf.memory = V4L2_MEMORY_MMAP;
    			buf.index = i;
    
    			if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_QBUF, &buf))
    				err(errno, "VIDIOC_QBUF");
    		}
    		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_STREAMON, &type))
    			err(errno, "VIDIOC_STREAMON");
    		break;
    
    	case IO_METHOD_USERPTR:
    		for (i = 0; i < n_buffers; ++i) {
    			struct v4l2_buffer buf;
    
    			CLEAR(buf);
    			buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    			buf.memory = V4L2_MEMORY_USERPTR;
    			buf.index = i;
    			buf.m.userptr = (unsigned long)buffers[i].start;
    			buf.length = buffers[i].length;
    
    			if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_QBUF, &buf))
    				err(errno, "VIDIOC_QBUF");
    		}
    		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_STREAMON, &type))
    			err(errno, "VIDIOC_STREAMON");
    		break;
    	}
    }
    
    static void uninit_device(void)
    {
    	unsigned int i;
    
    	for (i = 0; i < n_buffers; ++i)
    	{
    		if (-1 == munmap(buffers[i].start, buffers[i].length))
    		{
    			err(errno, "munmap");
    		}
    	}
    
    	free(buffers);
    }
    
    static void init_read(unsigned int buffer_size)
    {
            buffers = calloc(1, sizeof(*buffers));
    
            if (!buffers) {
                    fprintf(stderr, "Out of memory\\n");
                    exit(EXIT_FAILURE);
            }
    
            buffers[0].length = buffer_size;
            buffers[0].start = malloc(buffer_size);
    
            if (!buffers[0].start) {
                    fprintf(stderr, "Out of memory\\n");
                    exit(EXIT_FAILURE);
            }
    }
    
    static void init_mmap(void)
    {
            struct v4l2_requestbuffers req;
    
            CLEAR(req);
    
            req.count = 4;
            req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            req.memory = V4L2_MEMORY_MMAP;
    
            if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_REQBUFS, &req)) {
                    if (EINVAL == errno) {
                            fprintf(stderr, "%s does not support "
                                     "memory mappingn", I_V4L_pu8DeviceName_g);
                            exit(EXIT_FAILURE);
                    } else {
                            err(errno, "VIDIOC_REQBUFS");
                    }
            }
    
            if (req.count < 2) {
                    fprintf(stderr, "Insufficient buffer memory on %s\\n",
                             I_V4L_pu8DeviceName_g);
                    exit(EXIT_FAILURE);
            }
    
            buffers = calloc(req.count, sizeof(*buffers));
    
            if (!buffers) {
                    fprintf(stderr, "Out of memory\\n");
                    exit(EXIT_FAILURE);
            }
    
            for (n_buffers = 0; n_buffers < req.count; ++n_buffers) {
                    struct v4l2_buffer buf;
    
                    CLEAR(buf);
    
                    buf.type        = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                    buf.memory      = V4L2_MEMORY_MMAP;
                    buf.index       = n_buffers;
    
                    if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_QUERYBUF, &buf))
                            err(errno, "VIDIOC_QUERYBUF");
    
                    buffers[n_buffers].length = buf.length;
                    buffers[n_buffers].start =
                            mmap(NULL /* start anywhere */,
                                  buf.length,
                                  PROT_READ | PROT_WRITE /* required */,
                                  MAP_SHARED /* recommended */,
                                  u32_CamTofFileDescription_g, buf.m.offset);
    
                    if (MAP_FAILED == buffers[n_buffers].start)
                            err(errno, "mmap");
            }
    }
    
    static void init_userp(unsigned int buffer_size)
    {
            struct v4l2_requestbuffers req;
    
            CLEAR(req);
    
            req.count  = 4;
            req.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            req.memory = V4L2_MEMORY_USERPTR;
    
            if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_REQBUFS, &req)) {
                    if (EINVAL == errno) {
                            fprintf(stderr, "%s does not support "
                                     "user pointer i/on", I_V4L_pu8DeviceName_g);
                            exit(EXIT_FAILURE);
                    } else {
                            err(errno, "VIDIOC_REQBUFS");
                    }
            }
    
            buffers = calloc(4, sizeof(*buffers));
    
            if (!buffers) {
                    fprintf(stderr, "Out of memory\\n");
                    exit(EXIT_FAILURE);
            }
    
            for (n_buffers = 0; n_buffers < 4; ++n_buffers) {
                    buffers[n_buffers].length = buffer_size;
                    buffers[n_buffers].start = malloc(buffer_size);
    
                    if (!buffers[n_buffers].start) {
                            fprintf(stderr, "Out of memory\\n");
                            exit(EXIT_FAILURE);
                    }
            }
    }
    
    static void init_device(void)
    {
    	struct v4l2_capability cap;
    	struct v4l2_cropcap cropcap;
    	struct v4l2_crop crop;
    	struct v4l2_format fmt;
    	unsigned int min;
    
    	if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_QUERYCAP, &cap)) {
    		if (EINVAL == errno) {
    			fprintf(stderr, "%s is no V4L2 device\\n", I_V4L_pu8DeviceName_g);
    			exit(EXIT_FAILURE);
    		} else {
    			err(errno, "VIDIOC_QUERYCAP");
    		}
    	}
    
    	if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
    		fprintf(stderr, "%s is no video capture device\\n",
    				I_V4L_pu8DeviceName_g);
    		exit(EXIT_FAILURE);
    	}
    
    	switch (io) {
    	case IO_METHOD_READ:
    		if (!(cap.capabilities & V4L2_CAP_READWRITE)) {
    			fprintf(stderr, "%s does not support read i/o\\n",
    					I_V4L_pu8DeviceName_g);
    			exit(EXIT_FAILURE);
    		}
    		break;
    
    	case IO_METHOD_MMAP:
    	case IO_METHOD_USERPTR:
    		if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
    			fprintf(stderr, "%s does not support streaming i/o\\n",
    					I_V4L_pu8DeviceName_g);
    			exit(EXIT_FAILURE);
    		}
    		break;
    	}
    
    	/* Select video input, video standard and tune here. */
    
    	CLEAR(cropcap);
    
    	cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    
    	if (0 == xioctl(u32_CamTofFileDescription_g, VIDIOC_CROPCAP, &cropcap)) {
    		crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		crop.c = cropcap.defrect; /* reset to default */
    
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_S_CROP, &crop)) {
    			switch (errno) {
    			case EINVAL:
    				/* Cropping not supported. */
    				break;
    			default:
    				/* Errors ignored. */
    				break;
    			}
    		}
    	} else {
    		/* Errors ignored. */
    	}
    
    	CLEAR(fmt);
    
    	fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    	if (force_format) {
    		fmt.fmt.pix.width = 640;
    		fmt.fmt.pix.height = 480;
    		//fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_Y12;
    		fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_Y16;
    		fmt.fmt.pix.field = V4L2_FIELD_NONE;
    
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_S_FMT, &fmt))
    			err(errno, "VIDIOC_S_FMT");
    
    		/* Note VIDIOC_S_FMT may change width and height. */
    	} else {
    		/* Preserve original settings as set by v4l2-ctl for example */
    		if (-1 == xioctl(u32_CamTofFileDescription_g, VIDIOC_G_FMT, &fmt))
    			err(errno, "VIDIOC_G_FMT");
    	}
    
    	/* Buggy driver paranoia. */
    	min = fmt.fmt.pix.width * 2;
    	if (fmt.fmt.pix.bytesperline < min)
    		fmt.fmt.pix.bytesperline = min;
    	min = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height;
    	if (fmt.fmt.pix.sizeimage < min)
    		fmt.fmt.pix.sizeimage = min;
    
    	switch (io) {
    	case IO_METHOD_READ:
    		init_read(fmt.fmt.pix.sizeimage);
    		break;
    
    	case IO_METHOD_MMAP:
    		init_mmap();
    		break;
    
    	case IO_METHOD_USERPTR:
    		init_userp(fmt.fmt.pix.sizeimage);
    		break;
    	}
    }
    
    /**
     * @}
     */
    
    /* Exported functions --------------------------------------------------------*/
    
    /** @defgroup I_V4L_Exported_Functions I_V4L Exported Functions
     * @{
     */
    
    uint8_t I_V4L_OpenVideo(void)
    {
    	uint8_t u8_Status_f=SUCCESS;
    
    	/*SET I2C2 BUS PINMUX*/
    #ifndef VIDEO_TOF
    #define VIDEO_TOF
    	/* Open VIN2A pins in pinmux */
    	A_TR__WARN("Open VIN2A pins in pinmux");
    
    	/*CTRL_CORE_PAD_VIN2A_CLK0  (0x4A003554): 0x00040000
    				D0-D3:		VIN2A_CLK0_MUXMODE
    				  [0x0]:		vin2a_clk0
    					0x4:		vout2_fld
    					0x5:		emu5
    					0x9:		kbd_row0
    					0xA:		eQEP1A_in
    					0xC:		pr1_edio_data_in0
    					0xD:		pr1_edio_data_out0
    					0xE:		gpio3_28 gpmc_a27 gpmc_a17
    					0xF:		Driver off
    				D4-D7:		VIN2A_CLK0_DELAYMODE
    					Value:		This bit field selects the Virtual Timing Mode used when the MODESELECT bit is set to 0b1
    				D8:			VIN2A_CLK0_MODESELECT
    					[0]:		Default IO Timing Mode
    					  1:		Virtual or Manual IO Timing Mode
    				D16:		VIN2A_CLK0_PULLUDENABLE
    					[0]:		Enables weak Pull Up/Down
    					  1:		Disables weak Pull Up/Down
    				D17:		VIN2A_CLK0_PULLTYPESELECT
    					[0]:		Pull Down is selected
    					  1:		Pull Up is selected
    				D18:		VIN2A_CLK0L_INPUTENABLE
    					  0:		Receive mode is disabled
    					[1]:		Receive mode is enabled
    				D19:		VIN2A_CLK0_SLEWCONTROL
    					[0]:		Fast slew is selected
    					  1:		Slow slew is selected
    				D24:		VIN2A_CLK0_WAKEUPENABLE
    					[0]:		Wakeup is disabled
    					  1:		Wakeup is enabled
    				D25:		VIN2A_CLK0_WAKEUPEVENT
    					[0]:		No wakeup event detected
    					  1:		Wakeup event detected*/
    	I_MEM_Write(0x4A003554, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_DE0 (0x4A003558): 0x00040000*/
    	I_MEM_Write(0x4A003558, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_FLD0 (0x4A00355C): 0x00040000*/
    	I_MEM_Write(0x4A00355C, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_HSYNC0 (0x4A003560): 0x00040000*/
    	I_MEM_Write(0x4A003560, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_VSYNC0 (0x4A003564): 0x00040000*/
    	I_MEM_Write(0x4A003564, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D0 (0x4A003568): 0x00040000*/
    	I_MEM_Write(0x4A003568, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D1 (0x4A00356C): 0x00040000*/
    	I_MEM_Write(0x4A00356C, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D2 (0x4A003570): 0x00040000*/
    	I_MEM_Write(0x4A003570, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D3 (0x4A003574): 0x00040000*/
    	I_MEM_Write(0x4A003574, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D4 (0x4A003578): 0x00040000*/
    	I_MEM_Write(0x4A003578, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D5 (0x4A00357C): 0x00040000*/
    	I_MEM_Write(0x4A00357C, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D6 (0x4A003580): 0x00040000*/
    	I_MEM_Write(0x4A003580, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D7  (0x4A003584): 0x00040000*/
    	I_MEM_Write(0x4A003584, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D8  (0x4A003588): 0x00040000*/
    	I_MEM_Write(0x4A003588, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D9  (0x4A00358C): 0x00040000*/
    	I_MEM_Write(0x4A00358C, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D10  (0x4A003590): 0x00040000*/
    	I_MEM_Write(0x4A003590, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D11  (0x4A003594): 0x00040000*/
    	I_MEM_Write(0x4A003594, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D12  (0x4A003598): 0x00040000*/
    	I_MEM_Write(0x4A003598, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D13  (0x4A00359C): 0x00040000*/
    	I_MEM_Write(0x4A00359C, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D14  (0x4A0035A0): 0x00040000*/
    	I_MEM_Write(0x4A0035A0, 4, 0x00040000);
    	/*CTRL_CORE_PAD_VIN2A_D15  (0x4A0035A4): 0x00040000*/
    	I_MEM_Write(0x4A0035A4, 4, 0x00040000);
    #endif
    
    	/*Open Video Device*/
    	struct stat st;
    	I_V4L_pu8DeviceName_g = I_V4L__DEVICE_VIDEO1;
    
    	if (-1 == stat(I_V4L_pu8DeviceName_g, &st))
    	{
    		err(errno, "I_V4L_OpenVideo: Cannot identify '%s'", I_V4L_pu8DeviceName_g);
    	}
    	else
    	{
    		if (!S_ISCHR(st.st_mode))
    		{
    			fprintf(stderr, "I_V4L_OpenVideo: %s is no device\n", I_V4L_pu8DeviceName_g);
    		}
    		else
    		{
    			u32_CamTofFileDescription_g = open(I_V4L_pu8DeviceName_g, O_RDWR /* required */ | O_NONBLOCK, 0);
    
    			if (-1 == u32_CamTofFileDescription_g)
    			{
    				err(errno, "I_V4L_OpenVideo: Tried to open '%s'", I_V4L_pu8DeviceName_g);
    			}
    			else
    			{
    				fprintf(stderr,"I_V4L_OpenVideo: Video Device: %s Opening with Success!!!\n", I_V4L_pu8DeviceName_g);
    			}
    
    			init_device();
    		}
    	}
    
    	I_TOFCFG_TriggerHW();
    	start_capturing();
    	mainloop();
    	stop_capturing();
    
    	return u8_Status_f;
    }
    
    uint8_t I_V4L_CloseVideo(void)
    {
    	uint8_t u8_Status_f=SUCCESS;
    
    	A_TR__WARN("V4L Start closing...");
    
    	uninit_device();
    
    	if (-1 == close(u32_CamTofFileDescription_g))
    	{
    		err(errno, "Tried to close '%s'", I_V4L_pu8DeviceName_g);
    	}
    
    	u32_CamTofFileDescription_g = -1;
    
    	A_TR__WARN("V4L End of closing...");
    
    	return u8_Status_f;
    }
    
    
    /**
     * @}
     */
    

  • Hello Romain,

    Could you please help me by telling me what SDK  and version you are using?

  • @

    We are using a custom board based on an AM5708 SoC.

    Processor SDK build is based on Arago, We have made a Yocto Project with Linux kernel 4.19.94-gbe5389fd85